iTerm has a shell integration script that enables some fancy features, as in having the ability to scroll up to last prompt (in case if there was a lot of stdout i.e. when compiling some code). However if the terminal is not iTerm, that shell script fails and pollutes the prompt.

I'm trying to clean it up as in only run the shell integration if the terminal is iTerm.

  • It should be treated as a bug, shouldn't it? Dec 29, 2016 at 13:36

2 Answers 2


Putting this in your ~/.config/fish/config.fish should do the trick

if test $TERM_PROGRAM = iTerm.app
    test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish
  • 1
    This does not work once you log to another host with ssh as the TERM_PROGRAM variables is not defined anymore. Any idea?
    – anumi
    Jul 21, 2016 at 13:13

Putting this in your ~/.config/fish/config.fish should do the trick and check for $TERM_PROGRAM having been set.

test -n "$TERM_PROGRAM"
and test $TERM_PROGRAM = iTerm.app
and test -e {$HOME}/.iterm2_shell_integration.fish
and source {$HOME}/.iterm2_shell_integration.fish

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .