How to Make Emacs SSL Work on Mac OS X

If you find yourself on Mac OS X having problems getting SSL working for Emacs under Mac OS X, you might try installing GnuTLS and telling emacs to use that instead.

Why would you need this? In my case I was just trying to get Wanderlust (the best email client for emacs in my opinion) to connect to server that only support an SSL connection.

To Install GnuTLS

In general I recommend the MacPorts package as way to install GnuTLS (and many other useful packages).

Once you have MacPorts installed, you can then install GnuTLS with this command:

sudo port install gnutls

Tell Emacs to use GnuTLS

After that it is simply a matter of telling emacs you want to use GnuTLS by adding something like this to your .emacs:

(setq ssl-program-name "gnutls-cli"
      ssl-program-arguments '("--insecure" "-p" service host)
      ssl-certificate-verification-policy 1)

Odds are excellent it will work with the above setting, but that carries a security risk that someone might be “spoofing” the far end of the connection, but you wouldn’t know about it. For security reasons, you should therefore removed the "--insecure" part, but if you are dealing with self signed certificates that is certainly the lazy way out.