Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Mountain Lion and when I encrypt a file using gpg an annoying GUI prompts for me to enter the passphrase. I would like to be prompted for the passphrase in the terminal, not in an external GUI. I may be doing that remotely for example.

Is there a way to make gpg for mac ask for the passphrase in the terminal and no in a GUI prompt?

UPDATE: This seems very hard with gpg2 so I have downgraded to gpg1. Tried everything with gpg2 (MacGPG2) and nothing worked. Sucks! With gpg1 works fine!

share|improve this question

The following assumes you are using gnupg2 with macports, and not MacGPG2, but the fix will likely apply to your use case.

Install 'pinentry' package from macports:

port -v install pinentry

Edit your ~/.gnupg/gpg-agent.conf to suit:

pinentry-program /opt/local/bin/pinentry-curses

Remove or comment the existing 'pinentry-program' entry. Reload your terminal, or use this:

echo RELOADAGENT | gpg-connect-agent

Done. You should now have pinentry/passphrase in-terminal (curses dialog). If you wish to have the old gpg v1.x behaviour of inline-ttl pinentry, you may be able to use a custom './configure' command with the macports pinentry package.

If you have previously installed MacGPG2 / GPG tools for Mac, you may need to kill the 'shutdown-gpg-agent' process before the pinentry dialog will work (or just reboot).

user$ ps ax |grep shutdown-gpg-agent
 1854   ??  S      0:00.01 /bin/bash /usr/local/MacGPG2/libexec/shutdown-gpg-agent

user$ kill -KILL 1854
share|improve this answer

Three words: compile it yourself. Yes, you can do that! Be sure to get rid of the gpg-agent.conf file first though!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .