Contrary to endless outdated tutorials and Stack Overflow posts, installation and setup of GPG on macOS has been greatly simplified with GPG 2.1. Including its integration into the macOS Keychain so you don't have to type in passwords all the time. None of that manual gpg-agent starting and setting sockets is needed anymore.
The most recent 2.1 version of GPG is available via Homebrew:
brew install gpg pinentry-mac
The pinentry-mac
package will pop up a dialogue whenever GPG asks for a password. After installation, you need to point GPG to use the above installed pinentry-mac
by adding this line to ~/.gnupg/gpg-agent.conf
:
pinentry-program /usr/local/bin/pinentry-mac
# quickly add from Terminal:
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
Done. You now have the most recent GPG version running on your Mac.