The problem with installing older Ruby versions, is that Homebrew doesn’t ship their dependency, OpenSSL 1.0x, anymore. All the later versions of OpenSSL are incompatible with older versions of Ruby.

The only way to install older Ruby versions now, is to patch OpenSSL locally.


This article explains the download using Safari. With Chrome it's similar steps.

  • Open the article you're reading in Safari
  • Right click this link
  • Select "Download Linked File As"
  • Save as "openssl@1.0.rb" in "Downloads"
  • In Terminal, run: brew install ~/Downloads/openssl@1.0.rb to install this patched OpenSSL 1.0 version
  • In your zshrc, add x to PATH, or simply run the following in Terminal:
echo 'export PATH="/opt/homebrew/opt/openssl@1.0/bin:$PATH"' >> ~/.zshrc
  • Add the following exports to your zshrc:
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.0/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.0/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.0/lib/pkgconfig"

# For rbenv
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.0"
  • Reload your shell, in Terminal run: source ~/.zshrc
  • Verify your OpenSSL version:
openssl version
OpenSSL 1.0.2u  20 Dec 2019
  • Install Ruby using your preferred method, f.e.:
rvm install 2.3.0 --with-openssl-dir=/opt/homebrew/opt/openssl@1.0
  • In case you're receiving ffi errors, update by running bundle update ffi in Terminal