RVM, OpenSSL, Keystore, and you

Are you are encountering this error while attempting to install JRuby using RVM? And tearing your hair out?

OpenSSL::X509::StoreError: setting default path failed: Invalid keystore format

Here’s how to resolve it.

Add this to your .zshrc:

export SSL_CERT_FILE=/Library/Java/Home/lib/security/cacerts

Then, you might need to also do the following:

$ wget http://curl.haxx.se/ca/cacert.pem
$ sudo keytool -importcert -file cacert.pem -keystore /Library/Java/Home/lib/security/cacerts

It may ask you for a password. The default java keystore password is “changeit”.

You’re welcome.

Sources