Member-only story
Fixing GPG Commit Signing Errors on macOS (Inappropriate ioctl for device)
TL;DR
- Git commit signing may fail on macOS with:
gpg: signing failed: Inappropriate ioctl for device - The issue happens because the The
GPG_TTYenvironment variable isn’t set. - Fix by adding:
export GPG_TTY=$(tty)to your shell config. - For a smoother macOS experience, configure
pinentry-mac.
Not a Medium member? Keep reading for free clicking here.
When I set up a new MacBook recently, I followed my usual routine: installing Git, importing my GPG key, and enabling commit signing for security. Everything looked fine, until I tried to make my very first commit. Instead of a clean commit, Git threw back an unfamiliar error about GPG signing.
It wasn’t a show-stopper, but it was an annoying roadblock on a brand-new setup. A quick investigation led me to the root cause: the terminal didn’t know how to handle GPG’s passphrase prompt. In this post, I’ll share what the error means, why it happens, and exactly how you can fix it.
If you wanna try a hassle free machine setup, try devbox.
