Fix OpenSSL Read Server Certificate B: Certificate Verify Failed on OSX with RVM

openssl::ssl::sslerror: ssl_connect returned=1 errno=0 state=sslv3 read server certificate b: certificate verify failed

Getting the above error when running some gems?

Your SSL certificates may be out of date.

According to this, there’s actually a way to fix this without much work.

Pre-requisite: You should be using RVM.

  1. Verify that your certs are out of date:
$ rvm osx-ssl-certs status all
Certificates for /usr/local/etc/openssl/cert.pem: Old.
Certificates for /etc/openssl/cert.pem: Old.
$ rvm osx-ssl-certs update all

If you’re still having trouble, it could be because your OpenSSL is conflicting.

Try this:

$ rvm pkg install openssl; rvm reinstall all --with-open-ssl-dir=$rvm_path/usr --force