Search code examples
macosmavenhomebrewgnupg

"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 2.2.17.

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?


Solution

  • 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