- Uninstall and install
openssl
version 1.0.2. Asopenssl
v1.0.2 is no longer available, I have extractedopenssl
v1.0.2 and make it available at https://github.com/khun84/homebrew-repo/
brew uninstall --force --ignore-dependencies openssl
brew install khun84/homebrew-repo/openssl
brew cleanup # in case it fails due to permission denied, it can be due to the symlink to be removed is pointing to a non-exist file/directory. Just create the corresponding file or directory and run this command again
-
After OpenSSL installation, check it using
pkg-config --libs openssl
. You should see something like-L/usr/local/Cellar/openssl/1.0.2t/lib -lssl -lcrypto
-
Remove your rvm ruby 2.3.1 if you have not by
rvm remove 2.3.1
-
Install rvm ruby 2.3.1 by
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig rvm reinstall 2.3.1 --with-openssl-lib=/usr/local/opt/openssl --with-openssl-include=/usr/local/opt/openssl/include/openssl
. Verify you have the directory specified byPKG_CONFIG_PATH
,--with-openssl-lib
and--with-openssl-include
before you run this command! Otherwise you will need to redo Step 3 and Step 4 again.
- If it still doesn't work, may try
brew switch openssl 1.0.2t
. Here I already have openssl version1.0.2t
installed
Actually there might be not necessary to reinstall openssl. The root of the problem is that rvm is not able to compile a specific ruby with the correct openssl dependency.
So if we already have the desired openssl version install, which normally resides in
/usr/local/Cellar/openssl/{version}
(if you install it via homebrew), we can just install ruby with these flagsPKG_CONFIG_PATH=/usr/local/Cellar/openssl/{version}/lib/pkgconfig rvm reinstall 2.3.1 --with-openssl-lib=/usr/local/Cellar/openssl/{version} --with-openssl-include=/usr/local/Cellar/openssl/{version}/include/openssl