Unable to install Ruby Gems – SSL Cert Error

By December 25, 2014 Rails, Ruby

I recently got back into RoR development and found myself with an issue where I was unable to update any of my gems because of the following error:

Unable to download data from https://rubygems.org/ – SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

A temporary workaround I found was to just edit the individual rails projects gemfile and change the source from https to http. Now this obviously should not be the only solution and it seems to be an insecure solution. So I dug around a bit more and found another workaround/solution.

I have a Windows machine and use Bitnami for my installation since it was the most hassle free way of installing Rails on my system. In order to fix this problem, all I needed to do was manually install a certificate into my ruby installation folder.

You can download the certificate AddTrustExternalCARoot-2048 or via this github link if you don’t trust me.

In most cases, Bitnami installs Ruby into the following location:

C:\BitNami\

You will need to navigate to the following directory and paste the certificate you just downloaded into this folder:

C:\BitNami\rubystack-2.0.0-9\ruby\lib\ruby\2.0.0\rubygems\ssl_certs
(Obviously the folder location might be slightly different depending on your version of ruby.)

Paste the file in there and you should now be able to install your gems! It’s that simple.