Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

What is GPG command?

Key management commandsTo generate your own unique public/secret key pair: gpg --gen-key. To add a public or secret key file's contents to your public or secret key ring: gpg --import keyfile.

How do I install GPG on Windows 10?

Go to the GnuPG website to download the software: https://gnupg.org/download/index.html. Scroll to GnuPG Binary Releases. For the Windows OS, select the Download Sig link either for Simple Installer for the Current GnuPG or Simple Installer for GnuPG 1.4. Select Run and follow the steps to install the software.

What is gpg2?

gpg2 is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool to provide digital encryption and signing services using the OpenPGP standard. gpg2 features complete key management and all bells and whistles you can expect from a decent OpenPGP implementation.


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

As the instruction said "might need gpg2"

In mac, you can try install it with homebrew

$ brew install gpg2 

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

This worked for me

$brew install gnupg

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.