Emacs, gpg and pinentry on Mac

I use Emacs and GnuPG to save my passwords to an encrypted file. I’m really happy with this, as I save the encrypted file in Dropbox, and I can decrypt it across all machines and Operating Systems, and it syncs automatically. My Emacs config looks as follows:

(setenv "GPG_AGENT_INFO" nil)
(require 'password-cache)
(require 'epa-file)
(setq password-cache-expiry (* 15 60))
(setq epa-file-cache-passphrase-for-symmetric-encryption t)

This configuration saves my passphrase, so that I don’t need to keep typing it on every load or save, just when I first open the password file.

On some of my Mac environments though, I have the problem that the Mac keeps on starting the “Pinentry” GUI to get my passphrase, instead of asking in the Emacs minibuffer. The solution was to add the following to my .emacs file:

(setq epa-pinentry-mode 'loopback)


Leave a Reply