gpg安装过程中,出现如下错误。
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.
gpg: failed to create temporary file '/Users/chenzhaohua/.gnupg/.#lk0x00007fc299409f50.localhost.11964': Permission denied
gpg: can't connect to the agent: Permission denied
gpg: agent_genkey failed: No agent running
Key generation failed: No agent running
原因是当前用户对/Users/chenzhaohua/.gnupg目录没有访问权限。
首先输入命令
ls -al
可以看到 .gnupg 是属于 root用户的。
输入命令
sudo chown -R chenzhaohua:staff .gnupg/
ls -al
问题解决。