I've recently re-installed iTerm2 and am now running into an interesting problem after setting up iTerm's Shell Integration.
Upon open a new terminal window, everything seems to look correct, showing the proper "agnoster" theme from Oh My ZSH:
If I issue clear
, now my terminal window looks like this:
I can revert things to the original state by sourcing ~/.zshrc
once again, but I'm really curious about the root issue and if there's any way to fix it.
I have tried hiding the marker in iTerm's settings, but that just results in a blank terminal.
In a previous install (before I wiped this Mac), I had Oh My ZSH and Shell Integration both going, and although it looked kind of wonky at times, it still seemed to keep the Oh My ZSH theme regardless of clearing the terminal or issuing any other command.
Does anyone have any ideas on this? I've checked the iTerm settings over and over, but can't seem to find anything that would be related.
Late answer but this worked for me.
The iTerm2 Shell Integrations page has you download the install script and pipe it into bash.
Instead, download it locally and modify it so it knows you are using ZSH.
First, download the script
wget https://iterm2.com/misc/install_shell_integration.sh
Then, instead of having the script determine the shell just define it as "zsh"
# comment out this line
# SHELL=$(echo "${SHELL}" | tr / "\n" | tail -1)
# replace it with this line
SHELL="zsh"
Next, make the install script executable and then run it
chmod +x install_shell_integration.sh
./install_shell_integration.sh
After that the integration should be installed properly.
Note Remove the Bash integration if you don't need it.
rm ~/.iterm2_shell_integration.bash
I just installed the Shell Integration in iTerm 2 (Build 2.9.20160313) and had the exact same problem.
The way I solved it was by adding a single line to ~/.iterm2_shell_integration.zsh
right after export ITERM_SHELL_INTEGRATION_INSTALLED=Yes
at line 3:
ITERM2_PRECMD_PS1="$PS1"
Thus, this is how the head of the above-mentioned file looks:
if [[ -o login ]]; then
if [ "$TERM" != "screen" -a "$ITERM_SHELL_INTEGRATION_INSTALLED" = "" ]; then
export ITERM_SHELL_INTEGRATION_INSTALLED=Yes
## BEGIN EDIT
ITERM2_PRECMD_PS1="$PS1"
## END EDIT
# Indicates start of command output. Runs just before command executes.
iterm2_before_cmd_executes() {
printf "\033]133;C;\007"
}
# ...
It's likely a bug, since (as you can see from the comments in the same file) the script is supposed to save your $PS1
on login, but it does not.
For anyone still having this issue, there's now an option in iterm's profile settings that allows you to disable these "marks" ( which are detailed under the "marks" section on this page )
Screenshot of the setting within iterm preferences
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With