Using Emacs for Mac OS X 25.1.1 and gnupg2 2.0.30 installed via homebrew on macOS Sierra 10.12.2.
Emacs works correctly and gnugp2 also works well on the command line level (email addresses removed):
[email protected] 528 ~/Dropbox/org $ echo "Hello World" >text.txt
[email protected] 536 ~/Dropbox/org $ gpg -a -e -r x@y <text.txt >text.gpg
[email protected] 537 ~/Dropbox/org $ gpg -d text.gpg
You need a passphrase to unlock the secret key for
2048-bit RSA key, ID 37B58834, created 2017-01-18 (main key ID 45C04EA8)
gpg: encrypted with 2048-bit RSA key, ID 37B58834, created 2017-01-18
Hello World
My ./emacs/init.el says
; gpg
(require 'epa-file)
(epa-file-enable)
(setq epg-gpg-program "/usr/local/bin/gpg2")
and
[email protected] 505 ~/.emacs.d $ file /usr/local/bin/gpg2
/usr/local/bin/gpg2: Mach-O 64-bit executable x86_64
but I cannot seem to get Emacs to use gpg2; Meta-x epa-list-keys
yields:
GPG error: "no usable configuration", OpenPGP
I'm using gpg and gpg2 here but the first is a symlink to the latter.
What did I miss?
EDIT
Browsing trough EasyPG's source I got the impression that it only worked with gpg2 2.1+ so I uninstalled the homebrew version and installed version 2.1.17 from Sourceforge but that didn't help either.
So I ended up browsing some source files related to this question and mailed Daiki Ueno directly. He replied quickly, telling me to use custom-set-variables
instead of setq
:
(require 'epa-file)
(custom-set-variables '(epg-gpg-program "/usr/local/bin/gpg2"))
(epa-file-enable)
I assume this is obvious to Emacs people but I hardly use Emacs for anything else than org-mode, so it wasn't for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With