Cannot Install Any Ruby Gems on MAC Os - Ssl_Connect Error

Cannot install any ruby gems on Mac OS - SSL_connect error

I had the same issue and used the following 'work around'-
cd into your rails app directory and run the following

gem source -a http://rubygems.org/ 

This will use the insecure http connection rather than the secure https when you run the 'gem install...' command. It's not ideal but it is a short term work around.

You may also need to change the source line in your gemfile from

source 'https://rubygems.org'

to

source 'http://rubygems.org'

Why can't I install any gems on my Mac?

I had the same problem and this solution from above user worked for me.

rvm osx-ssl-certs update all

Unable install gems from 'https ://rubygems.org/' after MacOS Mojave update SSL/TLS (?)

I was able to install gems. I had to recompile all rubies:

$ ram uninstall ruby-1.8.7-p374
$ rvm install ruby-1.8.7-p374 --with-gcc=clang
$ rvm use ruby-1.8.7-p374@openssl-test01 --create
$ gem install rdoc-data -v 3.12

After this I was able to install although the link to /System/openssl is still shown in rvm osx-ssl-certs status all.

SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/

For RVM & OSX users

Make sure you use latest rvm:

rvm get stable

Then you can do two things:

  1. Update certificates:

    rvm osx-ssl-certs update all
  2. Update rubygems:

    rvm rubygems latest

For non RVM users

Find path for certificate:

cert_file=$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')

Generate certificate:

security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"

The whole code: https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/osx-ssl-certs


For non OSX users

Make sure to update package ca-certificates. (on old systems it might not be available - do not use an old system which does not receive security updates any more)

Windows note

The Ruby Installer builds for windows are prepared by Luis Lavena and the path to certificates will be showing something like C:/Users/Luis/... check https://github.com/oneclick/rubyinstaller/issues/249 for more details and this answer https://stackoverflow.com/a/27298259/497756 for fix.

SSL_connect unexpected message error trying to connect to rubygems on OSX Big Sur

Solution Found!

If you want to read an explaination visit his site: https://brettterpstra.com/2020/08/06/solving-rvm-and-openssl-issues-with-homebrew/

brew uninstall openssl --ignore-dependencies
brew tap-new $USER/old-openssl
brew extract --version=1.0.2t openssl $USER/old-openssl
brew install openssl@1.0.2t
brew install openssl
PKG_CONFIG_PATH=/usr/local/opt/openssl@1.0.2t/lib/pkgconfig \
rvm install 2.6.5 --with-openssl-dir=/usr/local/opt/openssl@1.0.2t

Replace the rvm version with the ruby version you want to use

et voila



Related Topics



Leave a reply



Submit