If you find yourself in a situation where you might need to install an older Ruby version on a newer Mac (M1 and newer) you are likely to run into a few issues.
This is my (failed) attempt to install Ruby 2.2.10 natively on MacOS Ventura 13.4. It is very unlikely that anyone else out there needs this specific combination, but if you do, please go ahead and enjoy the content.
I'll be using rbenv to install Ruby as it's my preferred tool for managing multiple Ruby versions at once.
Using Docker would probably be the better way to go but Docker on Mac is way slower than Docker on Linux, so be prepared to wait longer for everything.
Following this guide may or may not work for other Ruby versions, or other MacOS versions. Use at your own risk.
Install OpenSSL 1.0
This is the first requirement when trying to install this Ruby version as it was the supported OpenSSL version at the time of the Ruby release.
Trying to install Ruby 2.2 will initially lead to this error message, which is the first issue we will try to resolve
rbenv install 2.2.10
To resolve this, we'll start by first installing the main dependencies - OpenSSL.
The current OpenSSL version at the time of writing is 188.8.131.52, but Ruby versions lower than 2.3 require OpenSSL 1.0. Since OpenSSL 1.0 is now deprecated, it has since been removed from Homebrew.
The best way I found to install it is through this repo and the command to do so is:
brew install email@example.com
However, I quickly ran into this issue when installing:
brew install -d firstname.lastname@example.org
Configure Ruby Install Dependencies
We now need the `rbenv install` command to find the OpenSSL 1.0 libraries when installing, so we'll need to configure a few things in the terminal
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix email@example.com)" export optflags="-Wno-error=implicit-function-declaration"
Install Ruby 2.2
rbenv install 2.2.10
And we will run into one more error:
There is a wrong use of the `rm` command somewhere in the install command and we'll need some more manual intervention to fix it.
I found the solution in this discussion in the ruby-build repository, which involves removing the problematic command from the
With that, we should finally have Ruby 2.2.10 working 🎉 ... but the problems are not all gone yet
Can you live with no gems?
The main issue we now have to deal with is being unable to install gems. The first thing we need to install to be able to use any gem is bundler
The latest version of bundler cannot be installed on Ruby versions before 2.3, so we will need this workaround to install an older version
gem install bundler -v '~>1'
Even with this latest workaround, there is still a final unresolved issue when trying to install any gems, which takes us back to the OpenSSL issue. Now we can't even install bundler since we can't connect to rubygems over SSL
I still haven't been able to resolve this but if you have any pointers please leave a comment!
And this is how our adventure ends...in disappointment. After all this effort we have a barely usable old version of Ruby installed. If there ever was a perfect use case for Docker this is it. It was still fun giving it a try 😀
Please try to use supported versions of the software you use whenever possible