Short report about getting GPGSuite running so that it uses the GnuPG version which I did install with the package manage Nix.

Since I had a recent version of GnuPG installed via Nix, 2.1 in my case, there was an interoperability issue: GPGMail uses MacGPG which was bundled into the installation package and contained GnuPG version 2.0. This did cause a bit of a headache for me until I realized why things got mixed up: Since version 2.1 of GnuPG the format and file name for the key ring did change.

I ended up having two key rings:

# GnuPG version 2.1 and onward
~/.gnupg/pubring.kbx

# GnuPG before 2.1
~/.gnupg/pubring.gpg

So I wanted to convince GPGMail to use my already installed version of GnuPG. The version is available inside of my Nix profile as ~/.nix-profile/bin/gpg2.

It turned out to be a bit tricky, a first hacky solution:

  • Create a symlink in /usr/local/bin/gpg and also /usr/local/bin/gpg2 which both point into your nix profile ~/.nix-profile/bin/gpg2.
  • For Mail to work, I had to reboot once.

Afterwards the app GPG Keychain did show my key ring out of the file ~/.gnupg/pubring.kbx and also Mail did pick up the correct key ring.

Note

I did wipe the folder /usr/local/MacGPG2 to ensure that it cannot use this version by accident.

I think this is hacky, since I've now a symlink in /usr/local/bin which points into my personal Nix profile. Either being able to configure where the GPG executable can be found or adjusting the environment variable PATH would be better solutions.

This approach was inspired by this article in the knowledge base of GPGSuite.


Comments

comments powered by Disqus