gpg: symmetric encryption of ‘[stdin]’ failed: Operation cancelled

Trying this command:

tar -cvzf - "/Volumes/myfolder" | gpg -c --passphrase super-secret > backup.tar.gz.gpg

Was getting this error:

gpg: problem with the agent: Inappropriate ioctl for device
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of '[stdin]' failed: Operation cancelled

Running this, then trying again, fixed it:

GPG_TTY=$(tty)
export GPG_TTY

Source

--

--