When attempting to save some file.gpg, the minibuffer returns Opening output file: Searching for program, no such file or directory, gpg. According to the EmacsWiki, all that should be required is the following two lines in ~/.emacs.d/init.el

(require 'epa-file)

I am running Emacs 24.5.1 on Mac OS X 10.11.6. I installed gpg separately via terminal command brew install gpg, but this did not help. What am I missing?

1 Answer 1


Looks like a common issue with environment variables in GUI version of emacs. To solve this you can install exec-path-from-shell package and add this to your init file:


or you can modify exec-path by adding required folder:

(setq exec-path (append exec-path '("/path/to/binary/folder/"))
  • With the suggested package, encryption now seems to work, but decryption does not - attempting to reopen the file yields "Decrypting /path/to/file.gpg...done\n epa-file--find-file-not-found-function: Opening input file: Decryption failed". Any suggestions would be most welcome.
    – ktolbol
    Commented Nov 1, 2017 at 22:03
  • @ktolbol take a look at this answer - emacs.stackexchange.com/questions/27841/… Commented Nov 2, 2017 at 20:12
  • I tried those steps to no avail. I am also not convinced that the causes are the same, as in that answer, the error is "[...]Opening input file: Decryption failed, No secret key", whereas in my case, no further explanation is provided, the message simply ends at "Decryption failed, ".
    – ktolbol
    Commented Nov 2, 2017 at 21:00
  • Not sure why it is. Do you able to decrypt this file using gpg from terminal? Commented Nov 2, 2017 at 22:22
  • Strangely, it is working now from Emacs as well. Thanks a lot!
    – ktolbol
    Commented Nov 3, 2017 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.