[Ruby FAQs] Cannot install Ruby versions < 2.4 because of [email protected] dependency

openssl

The problem seems to be that homebrew upgraded their openssl install to 1.1. That version of openssl won’t work with rubies prior to 2.4.x. This problem was probably introduced to your Mac when you upgraded homebrew.

1
/Users/cloudolife/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)

Check the current openssl version.

1
2
$ ls -ls /usr/local/opt/openssl
0 lrwxr-xr-x 1 cloudolife 28 Apr 1 16:05 /usr/local/opt/openssl -> ../Cellar/[email protected]/1.1.1k

My work around was to install the older version of openssl (from of all places a tap by rbenv), then reinstall ruby version.

Downgrade OpenSSL

First, Install or downgrade to [email protected].

1
2
# Install older [email protected]
$ brew install rbenv/tap/[email protected]

Check [email protected].

1
2
ls /usr/local/Cellar/[email protected]/1.0.2t
CHANGES INSTALL_RECEIPT.json LICENSE NEWS README bin include lib share

Reinstall Ruby

Then reinstall that ruby version with [email protected] like this:

1
2
3
4
5
# asdf
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/Cellar/[email protected]/1.0.2t" asdf install ruby 2.3.0

# Or rvm
$ rvm reinstall 2.3.0 --with-openssl-dir='/usr/local/Cellar/[email protected]/1.0.2t'

Or Upgrade Ruby

Or install ruby 2.4(+) version directly compatible with [email protected].

References

[1] Installing Ruby 2.3.0 Can’t Find OpenSSL On Catalina · Issue #4908 · rvm/rvm · GitHub - https://github.com/rvm/rvm/issues/4908

[2] Error while installing Ruby 2.3.7 in mac os 10.15.5 Catalina using RVM; OpenSSL not found - Stack Overflow - https://stackoverflow.com/questions/62288633/error-while-installing-ruby-2-3-7-in-mac-os-10-15-5-catalina-using-rvm-openssl