Compiling from source code is a straightforward way to ensure that you have a genuine copy of GnuPG on your machine. Since GnuPG may be used to verify other software packages, it is important that your copy is not tampered with.
This post will outline the steps for compiling GnuPG classic v1.4.20 from source for Mac OS X rather than the latest version of GnuPG (v2.0.x) because it is much simpler to compile. Compiling GnuPG from source is certainly not any more difficult that using GnuPG, which is a command line program.
1.) Install command line developer tools for Mac OS X. This is dead simple on recent versions of Mac OS X 10.9 and up, simply open the Terminal and type “xcode-select –install”. The dialog below will appear and allow you to install the command line tools.
For older versions of Mac OS X, the procedure outlined here may work.
3.) Decompress and extract the source code archive.
bzip2 -d gnupg-1.4.20.tar.bz2
tar -xvf gnupg-1.4.20.tar
4.) From the source code directory, run the configure script to make sure your command line tools are installed.
5.) Assuming there are no errors, from the same directory run make to compile gnupg.
At this point, if everything went correctly, you should find the gpg executable in the g10 subfolder.
6.) If you wish to install GnuPG 1.4.20 as your default gpg:
sudo make install
You must uninstall other versions of gpg (including those installed by other software packages) before installing.