4

Hi I am new to Ruby on Rails. When I run rails db:create, I got the following error when I run it on M1 MBP:

/Library/Ruby/Gems/2.6.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `require': 
dlopen(/Library/Ruby/Gems/2.6.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle, 0x0009): 
missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle
- /Library/Ruby/Gems/2.6.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle (LoadError)

My ruby version is ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]

Any help is appreciated!

max pleaner
  • 26,189
  • 9
  • 66
  • 118
Jack
  • 41
  • 3

1 Answers1

6

I came across this issue as well using the ruby-2.6.3 that comes preinstalled with my M1 device.

My solution was changing the ruby version to something else because this is likely an issue with apple's preinstalled version of ruby. For example, I changed mine to 2.7.3 using rbenv (the recommended way to manage ruby versions):

rbenv install 2.7.3

Change ruby version globally using:

rbenv global 2.7.3

You may also need to relaunch your terminal or do other things to ensure that the new ruby version is being used.

Zex13
  • 141
  • 1
  • 7