Skip to content

Instantly share code, notes, and snippets.

@simonc
Created November 16, 2021 11:18
Show Gist options
  • Save simonc/e9eb1f9bf5c7193f06be6a4633c59404 to your computer and use it in GitHub Desktop.
Save simonc/e9eb1f9bf5c7193f06be6a4633c59404 to your computer and use it in GitHub Desktop.
Installing an old Ruby on an M1 mac
brew install automake bison openssl readline libyaml gdbm libffi openssl@1.1 shared-mime-info
brew tap raggi/ale
brew install openssl-osx-ca
brew services start openssl-osx-ca
export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
export LDFLAGS='-L/opt/homebrew/opt/openssl@1.1/lib'
export CPPFLAGS='-I/opt/homebrew/opt/openssl@1.1/include'
export PKG_CONFIG_PATH='/opt/homebrew/opt/openssl@1.1/lib/pkgconfig'
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"
mkdir /tmp/ruby-2.6.6
cd /tmp/ruby-2.6.6
curl https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.xz -o ruby-2.6.6.tar.xz
tar xfz ruby-2.6.6.tar.xz
cd ruby-2.6.6
./configure \
--prefix=$HOME/.rubies/ruby-2.6.6 \ # Change this to change the final install location
--build aarch64-apple-darwin20 \
--with-opt-dir=$(brew --prefix openssl@1.1):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm):$(brew --prefix libffi)
make -j2
make install
@bj97301
Copy link

bj97301 commented Mar 25, 2023

Thanks for making this. I am hoping it will help with some stupid cocoapod shit I am dealing with.

Unfortunately, i have never built ruby like this. I cant seem to get the make -j2 command to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment