Skip to content

Instantly share code, notes, and snippets.

@daffaromero
Last active October 7, 2025 07:54
Show Gist options
  • Save daffaromero/1418c4ad0938a461d621456f9f38ae74 to your computer and use it in GitHub Desktop.
Save daffaromero/1418c4ad0938a461d621456f9f38ae74 to your computer and use it in GitHub Desktop.
Ruby 2.6.10 environment setup on Apple Silicon Macs (includes OpenSSL 1.1 and MySQL 5.7)

Ruby 2.6.10 setup on macOS (Apple Silicon)

This guide shows how to set up an old Ruby + Rails environment on a modern macOS (Apple Silicon). As per October 2025, this works on an M1 MacBook Pro (2020) on macOS Sequoia 15.6.1. I assume it will also work on Tahoe 26.0, but I haven't tested it yet.

This is what you’ll end up with:

  • Ruby 2.6.10
  • OpenSSL 1.1 (needed for Ruby < 3.0)
  • MySQL 5.7

1. Install requirements

Make sure you have Homebrew installed:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then install these dependencies via brew:

brew install chruby zlib readline libyaml wget make gcc

2. Setting up chruby

Add the following to your ~/.zshrc (or ~/.bashrc if using bash):

# chruby setup
source $(brew --prefix chruby)/share/chruby/chruby.sh
source $(brew --prefix chruby)/share/chruby/auto.sh

Reload shell:

source ~/.zshrc

3. Install OpenSSL 1.1 and (optionally) MySQL 5.7, as seen on this Gist comment (thank you ferrucc-io!)

Please refer to the above Gist comment if you run into errors with this step.

Install OpenSSL 1.1 (mandatory for Ruby 2.6.10)

brew tap homebrew/core --force

# Restore [email protected] formula from an older commit
sudo curl -fL "https://raw.githubusercontent.com/Homebrew/homebrew-core/6c907880b95a3702348c1fcce1c661fcc03336e5/Formula/o/openssl%401.1.rb" \
  -o "/opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/o/[email protected]"
sudo sed -i '' '/disable! date: "2024-10-24", because: :unsupported/d' /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/o/[email protected]

# Install OpenSSL 1.1
brew tap-new local/old-openssl
cp /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/o/[email protected] \
   $(brew --repository local/old-openssl)/Formula/[email protected]
brew install local/old-openssl/[email protected]

Install OpenSSL certs:

For this, make sure OpenSSL 1.1 is installed in /opt/homebrew/opt/[email protected]

Check first if /opt/homebrew/etc/[email protected] exists, if so, replace the mkdir -p below with a cd

mkdir -p /opt/homebrew/etc/[email protected]
wget https://curl.se/ca/cacert.pem -O /opt/homebrew/etc/[email protected]/cert.pem
echo 'export SSL_CERT_FILE=/opt/homebrew/etc/[email protected]/cert.pem' >> ~/.zshrc
source ~/.zshrc

If your project depends on MySQL 5.7, you’ll need to re-tap the old formula because it’s been removed from Homebrew. Example steps:

# Restore [email protected] formula from an older commit
sudo curl -fL "https://raw.githubusercontent.com/Homebrew/homebrew-core/6c907880b95a3702348c1fcce1c661fcc03336e5/Formula/m/mysql%405.7.rb" \
  -o "/opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/m/[email protected]"
sudo sed -i '' '/disable! date: "2024-08-01", because: :unsupported/d' /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/m/[email protected]

# Install MySQL 5.7
brew tap-new local/old-mysql
cp /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/m/[email protected] \
   $(brew --repository local/old-mysql)/Formula/[email protected]
brew install local/old-mysql/[email protected]

4. Install Ruby 2.6.10

Use ruby-install with these OpenSSL/Zlib/Readline flags:

export OPENSSL_DIR="$(brew --prefix [email protected])"
export CPPFLAGS="-I$OPENSSL_DIR/include"
export LDFLAGS="-L$OPENSSL_DIR/lib"
export PKG_CONFIG_PATH="$OPENSSL_DIR/lib/pkgconfig"
export RUBY_CFLAGS="-Wno-error=deprecated-declarations"

wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.10.tar.gz
tar -xzf ruby-2.6.10.tar.gz
cd ruby-2.6.10

./configure \
  --prefix="$HOME/.rubies/ruby-2.6.10" \
  --with-openssl-dir="$OPENSSL_DIR" \
  --with-readline-dir="$(brew --prefix readline)" \
  --with-zlib-dir="$(brew --prefix zlib)" \
  --with-libyaml-dir="$(brew --prefix libyaml)"

make clean
make -j$(sysctl -n hw.ncpu)
make install

(Installs Ruby into ~/.rubies/ruby-2.6.10)


5. Switch to Ruby 2.6.10

Run this:

chruby 2.6.10

To make this Ruby version the default, add this to ~/.zshrc:

source $(brew --prefix chruby)/share/chruby/chruby.sh
source $(brew --prefix chruby)/share/chruby/auto.sh

chruby ruby-2.6.10

Note that the first two lines should probably have been added in a prior step.


6. Install bundler

Running a legacy version of Ruby means we are likely to run an older Rails version, therefore we need an older version of bundler:

gem install bundler -v 1.17.3

7. Verify Setup

Check versions:

ruby -v     # ruby 2.6.10p210
bundler -v  # Bundler 1.17.3
mysql -V    # mysql  Ver 14.14 Distrib 5.7.x

Done.

That's just about everything.


Alternatives

If OpenSSL is giving you a hard time with installation, compile it from the source.

wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar -xvf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config --prefix=/usr/local/opt/[email protected] --openssldir=/usr/local/opt/[email protected] shared zlib
make -j$(sysctl -n hw.ncpu)
make test
sudo make install

Make sure to replace brew --prefix [email protected] in the above steps with the directory that OpenSSL 1.1 is installed in, which should be /usr/local/opt/[email protected].

If you decide to do this step, make sure to install the OpenSSL cert and point Ruby to the right path:

sudo mkdir -p /usr/local/etc/[email protected]
wget https://curl.se/ca/cacert.pem -O /usr/local/etc/[email protected]/cert.pem
echo 'export SSL_CERT_FILE=/usr/local/etc/[email protected]/cert.pem' >> ~/.zshrc
source ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment