0

I just updated and reloaded rvm, rvm installed 2.4.0, and when I run gem I get:

➜  ~   gem install irbtools
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
➜

I Googled it, found several purported solutions, but didn’t find one that would work except for the suggestion to use the insecure gem URL, which I didn't want to do.

BTW, openssl is installed, but not by brew:

➜  ruby-2.4.0   brew install openssl
Warning: openssl is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version

How can I get gem to work with a secure gem source?

Keith Bennett
  • 4,722
  • 1
  • 25
  • 35
  • Also see [Brew refusing to link openssl](http://stackoverflow.com/q/38670295), [Update OpenSSL on OS X with Homebrew](http://stackoverflow.com/q/15185661), [How to install latest version of openssl Mac OS X El Capitan](http://stackoverflow.com/q/35129977), [How to upgrade OpenSSL in OS X?](http://apple.stackexchange.com/q/126830), [Openssl installation using HomeBrew fails](http://superuser.com/q/486389), etc. – jww Feb 18 '17 at 19:13

1 Answers1

1

The solution was to install brew's OpenSSL:

brew install --force openssl

(I got a strange message saying that `--force was ignored, but it did install ok.)

Then, do a brew info openssl and RTFM! :) Based on what it told me, I added this to my ~/.zshrc file:

# For Ruby 2.4 to find brew's OpenSSL: export LDFLAGS=-L/usr/local/opt/openssl/lib export CPPFLAGS=-I/usr/local/opt/openssl/include export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

Then, I opened a new terminal window and reinstalled Ruby 2.4:

rvm reinstall 2.4

After that, gem worked.

Keith Bennett
  • 4,722
  • 1
  • 25
  • 35