[SOLVED] Encrypt/sign failed! (Inappropriate ioctl for device) Code = 32870

Gwyneth Llewelyn's Avatar

Gwyneth Llewelyn

14 Nov, 2020 07:26 PM


On a different topic, I briefly mentioned the above error, which pops up when selecting some text and going to Services > OpenPGP: Sign Selection (see attached image). I can still select one of my keys on the first pop-up, but then it fails with the error.

As far as I can understand, this somehow means that communication with the gpg-agent is using the 'wrong' tty (or file-based socket? I really have no idea).

There is a reference on how to fix this at GitHub — allegedly, it does even work in macOS, but the replies on that issue are related to shell usage. I have had export GPG_TTY=$(tty) in my .bashrc/.bash_profile for a long time, but I assume that this only applies to things directly called from the shell... I haven't quite understood how gpg-agent is launched (aye, I've read all the instructions I could!) but it seems to me that there might be an issue at some point about what tty is actually being used for it.

Innapropriate ioctl for device is the error ENOTTY (code 32870 is basically the value of GPG_ERR_ENOTTY in decimal, defined on /usr/local/include/gpg-error.h)

Some more references: https://stackoverflow.com/a/1605290/1035977 and of course 'Not a typewriter' on Wikipedia.

I'm assuming that this is not a 'problem' of GPGtools but rather a misconfiguration on my side (currently running macOS Big Sur v11.0.1 (20B29)) — since this has been working flawlessly for a while, although it's true that I had the issue before adding the export GPG_TTY=$(tty) line to my .bashrc. I can speculate that either a) gpg-agent is not reading .bashrc when being launched from whatever launches it (while it did previously at some point in time) or possibly b) GPG Services is using a file-based socket to communicate with gpg-agent which, for some reason, is not correctly configured/accessed (but possibly this can be fixed easily, if you can point me to the right direction — there are a few file-based sockets inside ~/.gnupg, all of them rwx for my user, the same one that gpg-agent runs under).

FYI, this is the content of my configuration files:

default-cache-ttl 600  
max-cache-ttl 7200

default-key [my key here]  

Any suggestion is welcome!

  1. Support Staff 1 Posted by Steve on 15 Nov, 2020 11:29 PM

    Steve's Avatar

    Hi Gwyneth,

    Did you ever install a custom gpg version with fink/macports/brew/homebrew/from source? If so, could you remove it, repeat the steps and see if you are still running into the error message.


  2. Support Staff 2 Posted by Steve on 24 Nov, 2020 12:28 PM

    Steve's Avatar

    Closing, since no further user feedback was received. Should your problem persist, feel free to re-open this discussion any time.

    All the best,

  3. Steve closed this discussion on 24 Nov, 2020 12:28 PM.

  4. Gwyneth Llewelyn re-opened this discussion on 08 Dec, 2020 01:25 AM

  5. 3 Posted by Gwyneth Llewely... on 08 Dec, 2020 01:25 AM

    Gwyneth Llewelyn's Avatar

    Hi again,

    I'm really sorry — unfortunately, I missed the reply and subsequent closing of the thread.

    You were right: I had installed GnuPG with brew (a slightly more recent version than yours), and it overrode MacGPG2 when it was upgraded :-( As soon as I restored it (basically, removing some symlinks) everything started to work again.

    Thanks for the tip!

  6. Gwyneth Llewelyn closed this discussion on 08 Dec, 2020 01:25 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac