When openssl is not correctly installed on MacOS, we'll see error messages like:
Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
when running commands like:
gem install rails
The solution is either to reinstall openssl through Homebrew, or Ruby itself.
For example, if reinstalling with rbenv, run:
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.6.3
Replace 2.6.3 with the target version.