"gpg: signing failed: Inappropriate ioctl for device" on MacOS with Maven

On macOS you may want to use pinentry-mac to have GUI window to enter pin and optionally store pin in keychain.

You can install it though Homebrew:

brew install pinentry-mac

And enable it with the following line in your ~/.gnupg/gpg-agent.conf config (create it if it doesn't exists):

pinentry-program /usr/local/bin/pinentry-mac

I have added

GPG_TTY=$(tty)
export GPG_TTY

to my ~/.bash_profile file. Now it is working.

See also https://github.com/Homebrew/homebrew-core/issues/14737#issuecomment-309848851


Try this

gpg --use-agent --armor --detach-sign --output $(mktemp) pom.xml