I have similar issue when setting up on my mac M2, fixed by adding option:
gem install msgpack -v '1.4.2' -- --with-cflags=-Wno-error=incompatible-function-pointer-types
So I think you can try use the same version by replacing the version of above command to 1.4.4