Installing Ruby versions in MacBook M1

My MBP M1 is 5 months old and it is only now that I found time to make it run Ruby on Rails.

I used to work on an old MBP. It was my workhorse for the longest time and I had no problems with it until the battery needed to be changed and I can’t find a replacement.

Now that I have the M1, I met some challenges in migrating my RoR projects to work with this new machine.

I had difficulty installing other versions of Ruby. I needed version 2.7.0 to run the apps I was working on.

Scouring the web for solutions I found this one that works. If you are using asdf and needs to run Ruby 2.7.0. Just run this in your terminal, otherwise change “asdf” and “Ruby 2.7.0” with the Ruby version manager and Ruby version of your choice:

RUBY_CFLAGS=“-Who-error=implicit-function-declaration” asdf install ruby 2.7.0

Then run bundle update, then bundle and you’re ready to rails s your project.

Happy coding!