Installing mysql2 is not straightforward in M1. After installing the Rosetta version of mysql using brew, you need to follow up with the following command to install he mysql2 gem

arch -x86_64 gem install mysql2 -v 0.5.3 -- --srcdir=/usr/local/mysql/include

Replace it with the version from the your Gemfile.lock

Francium Tech is a technology company laser-focused on delivering top-quality software of scale at extreme speeds. The numbers and Size of the data excite us. If you have any requirements in building a large-scale application or want a free health check of your systems or architecture, feel free to shoot an email to contact@francium.tech, we will get in touch with you!

Photo by benjamin lehman on Unsplash

Installing the pg gem on Apple M1 silicon is not straightforward. As with many other development setup, it is recommended as of today to run all these software using Rosetta.

First download the Postgress app. Once done, ensure that you have the x86 Ruby installed (either through RVM or Rbenv)

Once done, you can run the below command to install the PG Gem.

arch -x86_64 gem install pg -v '1.1.4' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config

Francium Tech is a technology company laser-focused on delivering top-quality software of scale at extreme speeds. The numbers and Size of the data excite us. If you have any requirements in building a large-scale application or want a free health check of your systems or architecture, feel free to shoot an email to contact@francium.tech, we will get in touch with you!

To install Nokogiri on Apple M1, assuming you are using x86 Ruby this command would do the trick (no need to open the terminal in Rosetta mode)

arch -x86_64 gem install nokogiri -v '1.10.10' --platform=ruby -- --use-system-libraries

Francium Tech is a technology company laser-focused on delivering top-quality software of scale at extreme speeds. The numbers and Size of the data excite us. If you have any requirements in building a large-scale application or want a free health check of your systems or architecture, feel free to shoot an email to contact@francium.tech, we will get in touch with you!

After a lot of time-wasting in fighting the compilation errors of various ruby versions, I found out that this command consistently installs Ruby versions using rbenv (should work for RVM as well)

You might encounter errors like these

Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...
Installed openssl-1.1.1l to /Users/braga/.rbenv/versions/2.5.3
Downloading ruby-2.5.3.tar.bz2...
->…

Bragadeesh Jegannathan

Founder & CEO, Francium Tech

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store