Homebrew is the de facto package management tool for Mac OS.

To install homebrew:

# Head to https://brew.sh/ and follow the instructions
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Troubleshooting, Tips & How-Tos

Install previous versions of homebrew formulas

If the formula is still available from brew API

Use the formula@version syntax.

brew install gnupg@2.2

To stop brew automatically upgrade the package:

brew pin gnupg@2.2

If the formula is no longer available from the brew API

  1. Find the formula.rb from GitHub. E.g,. gnupg@2.2 (2.2.41)
  2. Edit the formula using brew edit gnupg@2.2, replace the content with the desired formula from GitHub
  3. Run HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall gnupg@2.2
  4. Run gpg --version to verify that the correct version is installed
  5. (Optional): use brew pin gnupg@2.2 to prevent it from auto-upgrade