"gpg: signing failed: Inappropriate ioctl for device" on MacOS with Maven
I have installed GPG via Homebrew with
brew install gpg.
It is installed in version
In my Maven POM I have this snippet:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-gpg-plugin</artifactId> <version>1.6</version> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin>
However when running
mvn clean verify I get this error:
gpg: Beglaubigung fehlgeschlagen: Inappropriate ioctl for device gpg: signing failed: Inappropriate ioctl for device
How can I fix this error?
I have added
GPG_TTY=$(tty) export GPG_TTY
~/.bash_profile file. Now it is working.
On MacOS you may want to have GUI window to enter pin for GPG that also allows to store pin in keychain and automatically use it. For that
pinentry-mac tool can be used.
You can install it though Homebrew:
brew install pinentry-mac
And add this line to your
~/.gnupg/gpg-agent.conf config (create it if it doesn't exists):
For me, this happened because the terminal window wasn't big enough to fit the passphrase TUI. Once I opened a bigger terminal tab and then I rerun the gpg command, I was able to see the passphrase terminal user interface.
gpg --use-agent --armor --detach-sign --output $(mktemp) pom.xml
- Try running maven with the
-Xargument to find the gpg command line that's actually executed.
- @JimmyB Unfortunately there ain't any gpg commands print when using
- It works once
killall gpg-agenthas been ran after applying your proposal.
- Thanks so much! This is probably the better way, not sure why this doesn't have more upvotes.