I just encountered a problem trying to install first the rails gem and then the watir gem.
$ 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!