how to avoid Pinentry pop-up window when using terminal

da_gar's Avatar


06 Nov, 2016 02:52 PM

Which of our tools is giving you problems? MacGPG2 and GPGServices as it was the only way to install GPG2 in my mac.

Paste version-info of all components (how to: Please, see attached file for version.

Describe your problem. Add as much detail as possible. I normally use gpg from terminal. Now, every time I encrypt something a Pinentry window will pop up asking for my passphrase.
Is there a way to avoid this and work only in terminal?

What did you expect instead Type passphrase in terminal window

Describe steps leading to the problem. Just using terminal as usual

Are you using any other plugins? No

  1. Support Staff 1 Posted by Luke Le on 18 Nov, 2016 07:57 PM

    Luke Le's Avatar


    if you add the following commands to your .bashrc file, you should be able to enter your passphrase in Terminal:

    export GPG_TTY=$(tty) export PINENTRY_USER_DATA="USE_CURSES=1"

    Hope that helps.

  2. 2 Posted by da_gar on 21 Nov, 2016 01:10 PM

    da_gar's Avatar

    Hi Luke

    Thanks for the answer.
    It helped in a funny way, it feels like moving pinentry to terminal.

    May I ask what these commands do. How to revert eventually to default Pinentry?

  3. Support Staff 3 Posted by Mento on 01 Dec, 2016 09:15 AM

    Mento's Avatar


    the commands sets 2 environment variables in the bash:
    PINENTRY_USER_DATA is passed to pinentry and it to show in the Terminal (USE_CURSES=1).
    GPG_TTY tells gpg2 which Terminal to use, to show pinentry. $(tty) means the current Terminal.

    To get the default pinentry you can remove the commands from your .bashrc (permanently).
    Or run the command "export PINENTRY_USER_DATA=''" (only the current seission).

    Regards, Mento

  4. 4 Posted by da_gar on 01 Dec, 2016 09:31 AM

    da_gar's Avatar

    Thank for the answer.

  5. Steve closed this discussion on 01 Dec, 2016 01:23 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac