[ruby] 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 dont already have it, and how do I get it the right way.

This question is related to ruby macos command-line rvm gnupg

The answer is


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

As the instruction said "might need gpg2"

In mac, you can try install it with homebrew

$ brew install gpg2 

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.


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

Examples related to ruby

Uninitialized Constant MessagesController Embed ruby within URL : Middleman Blog Titlecase all entries into a form_for text field Ruby - ignore "exit" in code Empty brackets '[]' appearing when using .where find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite? How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? How to update Ruby with Homebrew?

Examples related to macos

Problems with installation of Google App Engine SDK for php in OS X dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac Could not install packages due to an EnvironmentError: [Errno 13] How do I install Java on Mac OSX allowing version switching? Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Can't compile C program on a Mac after upgrade to Mojave You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) How can I install a previous version of Python 3 in macOS using homebrew? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"

Examples related to command-line

Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Flutter command not found Angular - ng: command not found how to run python files in windows command prompt? How to run .NET Core console app from the command line Copy Paste in Bash on Ubuntu on Windows How to find which version of TensorFlow is installed in my system? How to install JQ on Mac by command-line? Python not working in the command line of git bash Run function in script from command line (Node JS)

Examples related to rvm

How to resolve "gpg: command not found" error during RVM installation? RVM is not a function, selecting rubies with 'rvm use ...' will not work SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/ Which Ruby version am I really running? rvm installation not working: "RVM is not a function" Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v rmagick gem install "Can't find Magick-config" How to Uninstall RVM? How to remove RVM (Ruby Version Manager) from my system

Examples related to gnupg

gpg decryption fails with no secret key error How to resolve "gpg: command not found" error during RVM installation? Can't check signature: public key not found How to display gpg key details without importing it? How to Export Private / Secret ASC Key to Decrypt GPG Files How to trust a apt repository : Debian apt-get update error public key is not available: NO_PUBKEY <id> GnuPG: "decryption failed: secret key not available" error from gpg on Windows