Before I switched to a Mac the real™ GNU Emacs has been my main editor. On the Mac I used Aquamacs a lot but after the recent release of Emacs for Mac OS X Version 23.4 I decided to switch back to GNU Emacs. But after the change the integration with GPGTools stopped working.
I have a couple of sensitive files that I like to keep encrypted on disk. To view or edit these files I use EasyPG with auto encryption. This allows me to find a file with the
gpg extension and have Emacs load and decrypt the file at the same time. Saving the buffer automatically encrypts the file again.
After switching from Aquamacs to GNU Emacs the window for the passphrase would not show and Emacs signaled an error instead. Looking into the error it seemed that Emacs was looking for an executable
gpg which it could not find.
I came closer to the solution when I realized that GPGTools was installed in
/usr/local/MacGPG2 and a symbolic link
/usr/local/bin/gpg was pointing to the correct executable. So Emacs obviously wasn't checking
/usr/local/bin for the executable.
Emacs uses the variable
exec-path when looking for executables. A quick check revealed that I was right and
/usr/local/bin was indeed missing in the list. So the fix was as simple as putting the following code in my Emacs Init file:
After this change everything worked as before again. Finding an encrypted file opens a new window where you have to enter the passphrase for the file. If the passphrase is correct the decrypted file appears in an Emacs buffer. Saving that buffer writes the encrypted file to disk again.