I'm trying to generate a series of GPG keys gpg --gen-key but coming up with the same error that there's not enough entropy to generate a set.

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
jsdgpg: agent_genkey failed: Timeout
Key generation failed: Timeout

I can't seem to find any solution specific to OS X. Is there a way to generate more random numbers and avoid the timeout?

I'm using OS X 10.12.6 and gpg (GnuPG) 2.2.1.

  • I wonder if the installation instructions for your specific GPG suite has a step to ensure the permissions to track keyboard and mouse are installer or an alternate way to generate entropy...
    – bmike
    Oct 7 '17 at 15:55
  • @bmike is there a way to check this easily. At a guess I’d say gpg will have been installed via homebrew. Oct 7 '17 at 15:57
  • The command brew info gpg should tell you if that's how it arrived. If so, perhaps brew upgrade and then brew home gpg to get the maintainer notes?
    – bmike
    Oct 7 '17 at 15:59

Perhaps you could just rm -rf ~/.gnupg. It works for my situation. I just force stopped the first time I ran gpg --gen-key, which might lead me to this agent_genkey failed: Timeout error.

  • This didn't work until I also removed the agent file ~/.gpg-agent-info and killed the agent process gpg-agent-info. Also I regenerated the key with gpg2 --full-generate-key Jul 12 '20 at 12:14
  • Please make sure you do not have keys there. List keys: gpg --list-keys. Sep 7 at 20:19

In my case running killall gpg-agent allowed the next key generation attempt to succeed.

This is preferable to deleting ~/.gnupg and/or ~/.gpg-agent-info if you can avoid doing so (as referenced in another answer).

(On macOS 11.2.3 Big Sur)

  • Just killing gpg-agent fixed the issue for me. Make sure there are no keys in ~/.gnupg. To list keys gpg --list-keys Sep 7 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .