EDIT: Turns out I was able to partially solve my own problem - I'm not sure about the particular details, but as far as I know creating/editing ~/.bash_profile simply makes Terminal run scripts in that file automatically when launched. Seems like ~/.bashrc and other files do similar but still different things, but I don't know the details. What I did to fix was to edit my existing .bash_profile file and add the export GPG_TTY=$(tty) line to the end. This fixed GPG/git in Terminal.

The title may be confusing, so let me elaborate a bit.

My code as of now is like this:



echo "This script fixes errors with ioctl in GPG."

export GPG_TTY=$(tty)

The last line does help with the fix (issue detailed here; solution used), but I have to run it multiple times, every time I re-open a new Terminal window. Although the script may not necessarily be faster than simply typing it, it would still help for me.

As of now, the result is that it opens a new window in Terminal, with the output like this:

 This script fixes errors with ioctl in GPG.
 Saving session...
 ...copying shared history...
 ...saving history...truncating history files...

 [Process completed]

This does not help with any of the other windows I am using, so is there a way to make this fix apply to other windows, or open in the last used terminal window?

Additionally, is there a permanent fix to ioctl for GPG, or is there a way to automatically run this script whenever I open a new Terminal window, or when I use a command that uses GPG (e.g., git commit)?

Am I forced to either enter in the code manually or use a script file to do this?

This may be a bad or a simple question, but I'd like to ask it all the same.

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.