SSL_connect error when installing gems

SSL_connect error

You can encounter an SSL_connect error when issuing gem install similar to

ERROR: Could not find a valid gem 'jekyll' (>= 0), here is why: 
Unable to download data from https://rubygems.org/ 
- SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/latest_specs.4.8.gz)

To fix this issue download the GlobalSignRootCA.pem from Github and place it in a folder inside your ruby install folder, e.g. %RUBY_DIR%\ssl_cert\

Then execute the following command in your console to test

SET SSL_CERT_FILE=%RUBY_DIR%\ssl_cert\GlobalSignRootCA.pem

Replacing %RUBY_DIR% with your actual path.

Try issuing the gem install command again and if it works you should add a new environment variable SSL_CERT_FILE with this same path.

More information about this issue can be found on Luis Lavena’s Gist.

Still having SSL_connect issues?

I know, it is super frustrating. But try updating the RubyGems software within your Ruby installation. For this you can use the rubygems-update gem, but you need to download it manually.

Try installing a gem. If it succeeds, you are done!