How to save an SSL certificate with a Mac

posted by 1 year ago and updated 1 year ago

Sometimes self-generated certificates from our development servers don't play as nice with our browser. So, we need to take a little extra time to configure them. We basically want to download, export the certificate and import it into your system. In order for the certificate to be trusted.

openssl s_client -connect -showcerts

# In case you don't have openssl install it with brew
# brew install openssl

At this point your terminal will spit out some lines with the certificates. Copy the text to text editor, including the --- Beginning and End --- and save the file as server.crt.


Import SSL to Keychain Access

Now, if you want to import and allow this certificate, you can double click the certificate. It will import it to your keychain with a red 'x'. You can right click the certificate in your Keychain, select Get Info and then click on Trust (with an arrow next to it). Finally, choose Always Trust under the When using this certificate.