JDillon522
JDillon522

Reputation: 19686

How to resolve "gpg: command not found" error during RVM installation?

I have a new mac pro (OS X 10.9.5) that I get to set up from scratch. I want to install RVM and the first thing it says to do is:

Install mpapis public key (might need gpg2 and or sudo)

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

When I tried I got:

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
zsh: command not found: gpg

I've tried to find a good guide on how to overcome this that also looks trustworthy but I've had no luck.

Can someone explain what gpg is, why I don't already have it, and how do I get it the right way.

Upvotes: 207

Views: 241833

Answers (9)

Carlos  Robles
Carlos Robles

Reputation: 68

I was facing the same issue when I was trying to install RVM on a UNIX Apple M1.

I can solved my issue with this command:

gpg --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Instead of use gpg2:

gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

After run the command I had this output:

gpg: key 195BD3E759199BDB: 1 duplicate signature removed
gpg: /Users/User/.gnupg/trustdb.gpg: trustdb created
gpg: key 105BD0E739499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: key 3804BB82D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: Total number processed: 2
gpg:               imported: 2

Note: Don't forget to restart your command console.

Upvotes: 1

software_writer
software_writer

Reputation: 4478

Here are the steps to install RVM.

Step 1: Install gpg or gpg2 (both work)

brew install gpg

Step 2: Install GPG keys used to verify installation package:

gpg --keyserver hkp://pgp.mit.edu --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

If you encounter problem with the key server above, try a different one.

  • hkp://ipv4.pool.sks-keyservers.net
  • hkp://pgp.mit.edu
  • hkp://keyserver.pgp.com

Step 3: Install RVM

\curl -sSL https://get.rvm.io | bash -s stable

Check out the Security page if you still run into problems.

Upvotes: 12

A. KUMAR
A. KUMAR

Reputation: 490

After installing gpg using:

brew install gnupg2

This solution helped me get the keys to install rvm:

curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -

Upvotes: 3

Jeff
Jeff

Reputation: 14279

On my clean macOS 10.15.7, I needed to brew link gnupg && brew unlink gnupg first and then used Ashish's answer to use gpg instead of gpg2. I also had to chown a few directories. before the un/link.

Upvotes: 0

Ashish Pani
Ashish Pani

Reputation: 1071

On Mac OSX 10.15, Even after installing gpg, i was getting gpg2 command not found

$ brew install gnupg gnupg2
Warning: gnupg 2.2.23 is already installed and up-to-date
To reinstall 2.2.23, run `brew reinstall gnupg`

$ gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
-bash: gpg2: command not found

Instead, this worked for me

$ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Upvotes: 28

Reza Malik
Reza Malik

Reputation: 29

You can also use:

$ sudo gem install rvm

It should give you the following output:

Fetching: rvm-1.11.3.9.gem (100%)
Successfully installed rvm-1.11.3.9
Parsing documentation for rvm-1.11.3.9
Installing ri documentation for rvm-1.11.3.9
1 gem installed

Upvotes: -14

Jens Erat
Jens Erat

Reputation: 38732

GnuPG (with binary name gpg) is an application used for public key encryption using the OpenPGP protocol, but also verification of signatures (cryptographic signatures, that also can validate the publisher if used correctly). To some extend, you could say it's for OpenPGP what OpenSSL is for X.509 and TLS.

Unlike most Linux distributions (which make heavy use of GnuPG for ensuring untampered software within their package repositories), Mac OS X does not bring GnuPG with the operating system, so you have to install it on your own.

Possible sources are:

  • Package manager Homebrew: brew install gnupg gnupg2
  • Package manager MacPorts: sudo port install gnupg gnupg2
  • Install from GPGTools, which also brings GUI applications and integration in Apple Mail

Upvotes: 368

valmsmith39a
valmsmith39a

Reputation: 71

This worked for me

$brew install gnupg

Upvotes: 7

rderoldan1
rderoldan1

Reputation: 4098

As the instruction said "might need gpg2"

In mac, you can try install it with homebrew

$ brew install gpg2 

Upvotes: 37

Related Questions