I had to do quite some diving and hunting through documentation and forums, so I figured I might as well do a Q&A here for others:

How do I enable GnuPG passphrase prompting in the minibuffer? The Emacs 25.1 changelog says:

** pinentry.el allows GnuPG passphrase to be prompted through the minibuffer instead of a graphical dialog, depending on whether the gpg command is called from Emacs (i.e., INSIDE_EMACS environment variable is set). This feature requires newer versions of GnuPG (2.1.5 or later) and Pinentry (0.9.5 or later). To use this feature, add "allow-emacs-pinentry" to "~/.gnupg/gpg-agent.conf" and reload the configuration with "gpgconf --reload gpg-agent".

Doing just that, I just get an error message now and not even the graphical passphrase prompt.

This is GNU Emacs 25.2.2 on Lubuntu (Ubuntu Xenial) with GnuPG 2.1.11.


You also have to

  1. Explicitely enable loopback mode for pinentry in your gpg-agent.conf.
  2. Configure epa to use loopback for pinentry.
  3. Start the pinentry server in emacs,

1. Enable Emacs pinentry and loopback mode for gpg-agent

Put this in your ~/.gnupg/gpg-agent.conf:


Then tell gpg-agent to load this configuration with gpgconf in a shell:

gpgconf --reload gpg-agent

2. Configure EasyPG Assistant to use loopback for pinentry

In emacs, either do

M-x customize-group RET epa RET

Then set “Epa Pinentry Mode” to ‘loopback’ and apply.

Or put this in your ~/.emacs file:

(setq epa-pinentry-mode 'loopback)

Note: epa-pinentry-mode is deprecated since 27.1, either do

M-x customize-group RET epg RET

Then set “Epg Pinentry Mode” to ‘loopback’ and apply.

Or put this in your ~/.emacs file:

(setq epg-pinentry-mode 'loopback)

Finally, in Emacs, do

M-x pinentry-start RET

This starts the server for the current session. To start it in each new Emacs instance, put this into your .emacs:

  • I have implemented this approach and while it works using pass from within emacs I can no longer run pass from the command line. Is this the case for you? – orion Jun 22 '18 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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