Skip to content

GNU Emacs and GPGTool on Mac

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:

(add-to-list 'exec-path "/usr/local/bin")

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.


No Trackbacks


Display comments as Linear | Threaded

MarkJ on :

Thanks for this. I’m moving from Linux to Mac (because I think the Macbook Air hardware is better value than comparable Windows machines), and this really helped me get this part of my previous environment working on my new machine.

Thanks again!


Rob on :

Yeah. Same here. Recently switched from Debian driven Sony Laptop to Macbook. This hint was one piece to get the transition as perfect as possible.

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
Textile-formatting allowed
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Form options

Submitted comments will be subject to moderation before being displayed.