22

So I installed brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and then I installed gnupg2 and gnupg like so:

brew install gnupg gnupg2

I tried to install both again seperately like so:

brew install gpg2

brew install gnupg

and it said both are already installed. (wanted to confirm it).

Now, when I try to install RVM like so:

gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

my MAC says

-bash: gpg2: command not found

Any idea why?

Jay Patel
  • 317
  • 1
  • 2
  • 5
  • 3
    Maybe try typing just `gpg ...` instead of `gpg2`, it might be symlinked that way. – l'L'l Jan 27 '19 at 19:13
  • I had the same problem and nothing seemed to work, so eventually I did the following: 1) opened /usr/local/bin, 2) looked up the gpg symlink there, 3) duplicated it, 4) renamed the copy "gpg2", and everything started working fine again. – pilgix Jun 03 '21 at 21:39

3 Answers3

18

On Mac, installing with brew already gives you gpg2, but it's named as gpg, so you need to create an alias or a symlink. A symlink worked for me.

brew install gnupg

Get where is gpg located

which gpg

In my case it was /usr/local/bin/gpg

Then create symlink:

ln -s /usr/local/bin/gpg /usr/local/bin/gpg2
Sergio Gonzalez
  • 1,851
  • 1
  • 12
  • 12
  • 1
    Just for additional clarity you simply need to copy whatever path `which gpg` output as the `PATH` in: `ln -s PATH/gpg PATH/gpg2` – maxshuty Nov 30 '22 at 19:33
8

after

brew install gpg2

execute

gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
kevinluo201
  • 1,444
  • 14
  • 18
  • 6
    interesting, I see `gpg: keyserver receive failed: No route to host` Any explanation as to how your solution works and what else is going on here? – Brooks DuBois Dec 30 '19 at 19:54
  • I've just posted a solution here https://stackoverflow.com/questions/54801274/gpg-keyserver-receive-failed-no-route-to-host-stack-overflow/65858197#65858197 – luigi7up Jan 23 '21 at 10:38
0
  1. brew install gpg2
  2. curl -sSL https://rvm.io/mpapis.asc | gpg --import -
  3. curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -

This works for me

benpva16
  • 446
  • 6
  • 26
Shine
  • 11
  • 2