I need to have different color schemes for each of the two terminal types I use. I can set it in the .bash_profile as mentioned here. But how can I tell it to differ depending whether its a iTerm2 or default terminal instance?
How to find out which terminal app (iTerm or Terminal) is running from within bash
bashcommand lineitermterminal
Related Question
- MacOS – todotxt color not working on iTerm2
- ITerm2 applies strange color to vim’s default
- Generic exit function for iTerm2
- How to find the “friendly name” of the operating system from the shell / Terminal / bash
- Launch terminal program from macOS app
- ITerm2, zsh and .zshhistory – how to have separate zsh history
Best Answer
There is an environment variable set by iTerm and by Terminal as the following:
for Terminal:
for iTerm:
You should see this variable by typing in
env
from the command line.So - using this variable, you can put a condition in your .bash_profile file to select the proper coloring.