gem install: Unable to download data

I've had some problems recently with trying to install gems with a brew installed version of ruby 2.0.0. I'm not sure that this limited to Brew installs of Ruby though. I keep getting an error message stating Unable to download data from After a little research, it turns out that the certificates are outdated, and thus preventing me from using the default https protocol to get my gems.

$ gem install [desiredgemname]

ERROR: Could not find a valid gem '[desiredgemname]' (=, here is why:  
 Unable to download data from
 - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

All in all this is a pretty easy thing to workaround if you know about gem commands and parameters. There are a couple of ways to get around this temporarily. The less secure way is to change the sources that your gems are pulling from. THIS SHOULD ONLY BE USED TEMPORARILY!

gem sources -r  
gem sources -a  

On a per 'gem install' basis you can also do the following:

gem install [desiredgemname] --source  

But neither of these are a permanent solutions and you will have to remember to add the parms or add/remove sources every time.

After looking around a bit I found a better way to accomplish the same goal on a more permanent basis. I read an article that showed how to update SSL Certs via Brew. The important parts are here:

$ brew update
$ brew install openssl
$ brew link openssl --force
$ brew install curl-ca-bundle

And then in your config you will need to export your newly installed SSL Certs so they can be used.

export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt  

Hope this helps to consolidate everything. If you see something wrong leave me a comment.

Ray Pierce

Web Developer, RetailMeNot, Mentor, NodeBot builder, Texan

Austin, TX Ya'll
comments powered by Disqus