Cannot install Ruby Gem – certificate error

I just encountered a problem trying to install first the rails gem and then the watir gem.

I executed:

$ gem install rails

it failed with an OpenSSL error, a bit later I tried to install watir using:

$ gem install watir

I was surprised to see that it also failed with

# Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)

I wondered it might have something to with the fact that I am using rvm to manage my ruby environments, it turns out that it does indeed. It seems that the certificates in rvm must be updated manually every so often.

If you check the status of the certificates in rvm by running:

$ rvm osx-ssl-certs status all

you will probably see

# Certificates for /etc/openssl/cert.pem: Old.

to update them, run:

$ rvm osx-ssl-certs update all

(Note – you may need to enter your password.)

Hey presto, your problem should be resolved!

Advertisements

Please leave a comment - any questions or feedback welcome.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s