2013-10-16

FIX: Unable to download data from https://rubygems.org/ - certificate verify failed

I've used rvm for a while to manage my ruby installations and it works great. Today I've tried updating my gems with gem update and it tells me "nothing is to be updated". Eh? At least I know cocoapods is updated from my installed 0.24 to 0.26. What happened?

Then I tried to update gems manually. Firstly:

> gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 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://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)

 Great! That's the reason. There is a long long list of the issue under https://github.com/rubygems/rubygems/issues/515

The solution suggested are:
1. use an insecure connection to rubygems.org with:

> gem update  --source http://rubygems.org

It works. But it doesn't solve the problem

2. RVM should update its certificates:


> rvm osx-ssl-certs status all
Certificates for /etc/openssl/cert.pem: Old.


> rvm osx-ssl-certs update all
Updating certificates for /etc/openssl/cert.pem: Updating certificates in '/etc/openssl/cert.pem'.
mkdir: /etc/openssl: Permission denied
Admin password required for 'mkdir -p /etc/openssl':
Updated.

Then everything should be fine now.

A detailed information can be found at http://railsapps.github.io/openssl-certificate-verify-failed.html

For non-RVM and non-MAC users, here is the answer: http://stackoverflow.com/questions/19150017/ssl-error-when-installing-rubygems-unable-to-pull-data-from-https-rubygems-o

No comments: