Ian Jones Logo

Open SSL

Open SSL issue when installing a Ruby gem

I was getting this error:

ERROR:  Loading command: install (LoadError)
        dlopen(/Users/ianjones/.rbenv/versions/2.5.0/lib/ruby/2.5.0/x86_64-darwin19/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib


The fix was to:

brew upgrade rbenv ruby-build


ruby-build installs a non-Homebrew OpenSSL for each Ruby version installed and these are never upgraded.

To link Rubies to Homebrew's OpenSSL 1.1 (which is upgraded) add the following
to your ~/.zshrc:
  export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"

Note: this may interfere with building old versions of Ruby (e.g <2.4) that use
OpenSSL <1.1.