I've used Emacs' built-in gpg support to encrypt/decrypt files for years. A few days ago, I tried to save an ecrypted file that had changes and the save wouldn't finish. The minibuffer shows "Saving file ..." but doesn't save.

Emacs doesn't hang (I'm able to quit the process with C-g), but nothing happens. I don't see any errors reported in *Messages*.

I created a new test file, encrypted it with epa-encrypt-file, decrypted it, then changed it and tried to save - same result, the save doesn't complete.

I'm not certain these are relevant, but these are found on my system (installed via Homebrew):

  • gpg (GnuPG) 2.4.3
  • libgcrypt 1.10.2

4 Answers 4


This issue is now fixed with the latest gnupg 2.4.4 (I upgraded and am able to encrypt .org.gpg files) https://dev.gnupg.org/T6481


Downgrade to GnuPG 2.4.0 should help.

There is an issue registered in gnupg and numerous reports in other resources: https://dev.gnupg.org/T6481

It is still not fixed as of GnuPG 2.4.3, unfortunately.

  • 2
    Homebrew doesn't have a formula for 2.4.0 so I downgraded to 2.2.41. I'm sure that's not ideal, but at least it works. Thank you so much @maxim-kim!
    – vortek
    Commented Jul 25, 2023 at 0:28
  • 2
    @vortek you can use this script: gist.github.com/sankalp-khare/94fee1727ec5d199018be225127510d2 like ./switch-gnupg.sh 2.4.0 to change to version 2.4.0 in your homebrew setup. It will also pin that version so that subsequent brew upgrade won't get you back to the latest.
    – Sankalp
    Commented Jul 26, 2023 at 7:30
  • 1
    For those on mac having this issue... Uninstall new gpg: brew uninstall gnupg Install old gpg: brew install [email protected] Symlink so that Emacs finds it: ln -s /opt/homebrew/opt/[email protected]/bin/gpg /opt/homebrew/bin/ Commented Sep 18, 2023 at 14:20

If downgrading gnupg is not an option one can also set this in the Emacs config:

(fset 'epg-wait-for-status 'ignore) ; this is dangerous see below

After that Emacs is able to write the *.gpg file just fine (see my edit below for caveats!).

Source: https://www.masteringemacs.org/article/keeping-secrets-in-emacs-gnupg-auth-sources


As mentioned in the comments, while the proposed solution above works, it is not recommended as it may incur in data loss (though it hasn't happened to me it is something you need to be aware of). The proper solution (for now) is to use a custom build of GPG 2.4.1 with gniibe's patch applied https://dev.gnupg.org/rG2f872fa68c6576724b9dabee9fb0844266f55d0d.

  • This seems to work... except that it doesn't. As it says in the last comment of the masteringemacs.org.
    – dvdgc13
    Commented Dec 8, 2023 at 12:32
  • Thanks for the heads up @dvdgc13 I've edited my answer.
    – zzantares
    Commented Dec 22, 2023 at 19:04

Since the fix for Emacs+EasyPG does not seem guaranteed, I am using a custom formula from my personal Homebrew tap with a version that I know works:

brew tap pgpbpadilla/pgpb 
brew install [email protected]

More details at: https://github.com/pgpbpadilla/homebrew-pgpb

Original post: https://stackoverflow.com/a/77629200/400544

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.