Emacs epa and gnupg2: "no convenient configuration"

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 at the command line level (removed email addresses):

pu@pumbair.local 528 ~/Dropbox/org $ echo "Hello World" >text.txt pu@pumbair.local 536 ~/Dropbox/org $ gpg -a -e -r x@y <text.txt >text.gpg pu@pumbair.local 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

 pu@pumbair.local 505 ~/.emacs.d $ file /usr/local/bin/gpg2 /usr/local/bin/gpg2: Mach-O 64-bit executable x86_64 

but I can't get Emacs to use gpg2; Meta-x epa-list-keys gives:

 GPG error: "no usable configuration", OpenPGP 

I use gpg and gpg2 here, but the first is a symlink to the latter.

What did I miss?

EDIT

Viewing the tray of the EasyPG source I had the impression that it worked only with gpg2 2.1+, so I uninstalled the homebrew version and installed version 2.1.17 from Sourceforge , but that also did not help.

+5
source share
2 answers

So, I ended up looking at some source files related to this question and sent Daiki Ueno directly. He quickly answered and told 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 other than org-mode, so it wasn’t for me.

+7
source

gpg only inside /usr/local/gnupg-2.2/bin . In Eamcs (getenv "Path") and exec-path contains only /usr/bin , but the new version of macOS restricts access to /usr/bin .

My solution is to create a symlink and add a path to the emacs environment and a path to its exec.

 cd /usr/local/bin ln -s ../gnupg-2.2/bin/gpg2 gpg 

Inside .emacs

 (setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin")) (setq exec-path (append exec-path '("/usr/local/bin"))) 
0
source

Source: https://habr.com/ru/post/1263051/


All Articles