I’ve had this same issue manifest on 4 different macs, and while the solutions on OpenSSL Errors and Rails – Certificate Verify Failed sometimes worked, I still hit this error on a brand new iMac late last month.
Finally realized that
“openssl::ssl::sslerror: ssl_connect returned=1 errno=0 state=sslv3 read server certificate b: certificate verify failed” really wasn’t about verifying the certificate: It was about finding the certificate.
Here’s how to diagnose and fix:
1. do a PRINTENV from the command line.
2. Where is SSL_CERT_FILE pointing to? (Mine was SSL_CERT_FILE=/usr/local/etc/openssl/certs/cert.pem).
3. Is there a cert.pem, NOT an alias (unless it actually points to a file), there? (beware of the alias cert.pem in /usr/local/etc/openssl – in my case it was pointing to a non-existant cert.pem in the certs directory!).
4. If not, find a cert.pem and copy it there.
5. Extra credit: add export SSL_CERT_FILE=/usr/local/etc/cacert.pem to your .bashrc file.
6. Restart terminal.
By the way, if you don’t know about Daniel Kehoe’s RailsApps.org you really really should.