Configure the keyring used by GPG Mail?

jcross's Avatar

jcross

11 Feb, 2020 05:24 PM

I would like to temporarily use an alternative keyring for encrypting / signing email.
I tried to set GNUPGHOME on the commandline, then launch Mail.app from there (which works for GPG Keychain.app) -- but that didn't work. It continued using the default keyring in ~/.gnupg/.

  1. Support Staff 1 Posted by Luke Le on 12 Feb, 2020 08:55 PM

    Luke Le's Avatar

    Hi Jonathan,

    that will unfortunately not work, since Mail.app itself can't communicate with the gpg binary, but instead a separate XPC takes care of that, which is launched on demand, so it's not easily possible to set environment variables for that XPC.

    What you could try is to temporarily symlink the new GNUPGHOME to ~/.gnupg.

    Hope that helps.

  2. 2 Posted by jcross on 13 Feb, 2020 12:01 PM

    jcross's Avatar

    Okay, I'll try that.
    I was a bit hesitant to mess with the ~/.gnupg as there are various open sockets from different processes there, etc.

  3. Support Staff 3 Posted by Luke Le on 13 Feb, 2020 12:45 PM

    Luke Le's Avatar

    That should not be a big problem.
    Just make sure to always create a backup of ~/.gnupg before switching it with a symlink and to stop all gpg related processes:

    killall gpg-agent
    killall gpg
    killall dirmngr
    killall scdaemon
    

    and applications that might be using it, e.g. GPG Keychain, Mail, org.gpgtools.Libmacgpg.xpc (use ps aux | grep -I libmacgpg\.xpc to find its pid). If you do that, no important data should be corrupted.

  4. 4 Posted by jcross on 18 Feb, 2020 07:25 PM

    jcross's Avatar

    Thanks. That worked.

  5. Support Staff 5 Posted by Luke Le on 18 Feb, 2020 09:19 PM

    Luke Le's Avatar

    Great to hear that.

    Sorry there's no easier way to do this.

  6. Steve closed this discussion on 19 Feb, 2020 11:51 PM.

  7. Steve re-opened this discussion on 08 Nov, 2023 04:55 PM

  8. Steve closed this discussion on 08 Nov, 2023 04:56 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac