I want to install a new version of ruby via rvm. To install that, I need gnupg2. I installed it using brew, but it could not be linked.

I get the following error message when linking with brew link gpg2:

Linking /usr/local/Cellar/gnupg/2.1.20... 
Error: Could not symlink bin/gpg-agent
Target /usr/local/bin/gpg-agent
is a symlink belonging to gpg-agent. You can unlink it:
brew unlink gpg-agent

To force the link and overwrite all conflicting files:
brew link --overwrite gnupg

To list all files that would be deleted:
brew link --overwrite --dry-run gnupg

I have no idea what the gpg-agent does and if I can savely overwrite the link without destroying something that my system somewhere needs.

1 Answer 1


By default, macOS does not use anything under /usr/local, so yes you can brew link --overwrite gnupg safely.

  • 1
    ok. thanks. but why doesn't brew link it automatically like it normally does?
    – McLawrence
    Apr 17, 2017 at 11:27
  • Becasue somehow there's already a /usr/local/bin/gpg-agent file. Maybe from a past install of gnupg or GPGTools?
    – Python Kid
    Apr 17, 2017 at 15:35
  • Now it is successfully linked, but after typing gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 (as written in the manual on rvm.io/rvm/install), I get the error message: gpg: Empfangen vom Schl"usselserver fehlgeschlagen: No route to host, where the first part is german and means: "Receiving of Keyserver failed". Do you have any idea, what causes this?
    – McLawrence
    Apr 18, 2017 at 19:27
  • Sounds like a GPG issue, I used to encounter this with GPG on MacPorts but have yet to fix it. Googling around shows some people which managed to fix it.
    – Python Kid
    Apr 19, 2017 at 15:21

You must log in to answer this question.

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