Which Terminal App am I Using?

Snippet

macosx has full disk permissions limiting access to certain directories and files. If one app, say iTerm has access but another program does not, say xterm, a bash script might need to check which application can be run with the appropriate permissions.

Look for TERM_PROGRAM

$ echo $TERM_PROGRAM
iTerm.app
 
$ env | grep TERM_
TERM_PROGRAM=iTerm.app
TERM_PROGRAM_VERSION=3.3.12
 
# or in a script
if [[ $TERM_PROGRAM != 'iTerm.app' ]]; then
  echo "You need to run this with iTerm for full disk permissions"
  exit
fi

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.