# Install Intel/Rosetta Homebrew
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Temporarily alias Intel Homebrew for conciseness
# You can add this to your shell config to make it more permanent
alias brew_intel="arch -x86_64 /usr/local/bin/brew"
brew_intel install readline
brew_intel install nutcracker/tap/[email protected]
# ...which is a fork of rbenv/tap/[email protected], anticipating a merged pull request: https://github.com/rbenv/homebrew-tap/pull/2
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew_intel --prefix [email protected]) --with-readline-dir=$(brew_intel --prefix readline)"
export optflags="-Wno-error=implicit-function-declaration"
arch -x86_64 asdf install ruby 2.1.6
# Must install old version of Bundler for Ruby < 2.2
gem install bundler -v '1.17.3'
Note: Some gems may fail to install during bundle install
.
For some you can follow the prompts to gem install
them one-by-one, prefixing them with arch -x86_64
.
brew_intel install [email protected]
brew_intel link --force [email protected]
brew_intel services restart [email protected] # Maybe not necessary?
arch -x86_64 gem install mysql2 -v '0.3.21' -- --with-mysql-config=/usr/local/Cellar/[email protected]/5.7.37/bin/mysql_config --srcdir=/usr/local/Cellar/[email protected]/5.7.37/include
arch -x86_64 gem install nokogiri -v '1.6.8' --platform=ruby -- --use-system-libraries
brew_intel install [email protected]
gem install libv8 -v '3.16.14.15' -- --with-system-v8
gem install therubyracer -v '0.12.1' -- --with-v8-dir=/usr/local/opt/[email protected]
gem install mysql2 -v '0.3.21' -- --with-mysql-config=/usr/local/bin/mysql_config --with-ldflags=-L/usr/local/Cellar/[email protected]/1.0.2u/lib --with-cppflags=-I/usr/local/Cellar/openssl@1/0/1.0.2u/include
Solution originally pieced together from here:
- https://soffes.blog/homebrew-on-apple-silicon
- https://github.com/rbenv/ruby-build/wiki#openssl-version-compatibility
- rbenv/homebrew-tap#2 (comment)
- rbenv/ruby-build#1353 (comment)
- rubygems/bundler#6865 (comment)
- https://gist.github.com/fernandoaleman/868b64cd60ab2d51ab24e7bf384da1ca#gistcomment-3723625
- (2022-03-07) Lanny Bose on an M1 (Pro) MacBook Pro on MacOS 12.2.1