I'm trying to figure out why zsh's prompt looks like this:

zsh prompt example

(in text form):

\[\]\u\[\] at \[\]\h\[\] in \[\]\w\[\]$(__git_ps1) \[\]$(git_diff)\n\[\]($(date +'1:MikesMBP.local ')) \[\]$\[\]

I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:

# Lines configured by zsh-newuser-install
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/Users/mike/.zshrc'

autoload -Uz compinit
# End of lines added by compinstall

This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?

2 Answers 2


You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.


bash uses \[ and \] to mark parts of the prompt which are nonprinting.

zsh uses %{ and %} for the same purpose.

The xterm manual has a section which mentions this.

  • So if I start my terminal with zsh as the default shell it'll fix it?
    – user313852
    Jan 14, 2019 at 0:35
  • no - see other answer: zsh is seeing the PS1 which bash knows how to handle. Jan 14, 2019 at 0:47

You must log in to answer this question.