Recently I ran into issues trying to install new rubies with RVM. All of my errors centered around
openssl, and they took me a fair amount of time to resolve. So I’m putting this up mostly as notes to myself and hopefully to help anyone else who runs into this.
Homebrew (fairly) recently updated the
openssl formula to 1.1. RVM (and some random daemons on my machine) require
openssl 1.0 to compile/install older rubies. In fact, I was running into issues even trying to install Ruby 2.6.5. Manually trying to install
openssl 1.0 didn’t work for me, nor did a dozen other solutions I tried. Here’s the magic formula that worked:
brew uninstall openssl --ignore-dependencies brew tap-new $USER/old-openssl brew extract --version=1.0.2t openssl $USER/old-openssl brew install email@example.com
This creates a “tap” for the older version of OpenSSL so you can install it with Homebrew. Once this is all working, you can actually install v1.0 next to it and with the right path settings, use them both as needed.
The secret to getting RVM to use the right version is
pkg_config. By setting the path to the
openssl 1.0 version of this in the
PKG_CONFIG_PATH environment variable, you can get rvm to install using the older libraries. Here’s the incantation (using Bash):
PKG_CONFIG_PATHfirstname.lastname@example.org/lib/pkgconfig \ rvm install 2.6.5 --email@example.com
Credit for this goes to Jakob Skjerning.
Like I said, once this is working you can just
brew install openssl to get an up-to-date version installed, leaving the 1.0 version in place. When you need to use it, you can just apply the paths needed and everything else will continue using 1.1+.
Hope that helps someone (and probably future me).