SSL Error (failed certificate) with Ruby, Rails and OSX

Outdated SSL certificate files could be the reason you’re getting the Ruby error:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed.

If you have RVM installed, you could try this to update your SSL certificates:

rvm osx-ssl-certs status all
rvm osx-ssl-certs update all

This didn’t work in my case, however.

Alternatively (and what ended up working for me), you can try following thoughtbot’s Rails development setup script for Mac OS X and download a bundle of CA Root Certificates from Mozilla (

# download cert.pem file for openssl
cd /usr/local/etc/openssl/certs/
sudo curl -O
sudo mv cacert.pem cert.pem
cd -
echo "
# cert.pem file for openssl 
export SSL_CERT_FILE=/usr/local/etc/openssl/certs/cert.pem" >> ~/.bash_profile
source ~/.bash_profile

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *