zsh on osx mojave not updating vcs_info

Keywords: git terminal command-prompt zsh


I'm on OSX Mojave and using zsh as my login terminal -- I use the Terminal app.

I'm just trying to show the current branch of the git repository I'm inside (if available) by using vcs_info. The relevant portion of my .zshrc file is as follows:

autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats "%F{010}(%b)%f "

# I have also tried omitting the "function" qualifier for precmd
function precmd() { vcs_info }
setopt prompt_subst

PROMPT="%F{226}%m:%n @ %F{214}%1d %F{226}\$%f ${vcs_info_msg_0_}"

I expect:

  1. I load the terminal and start at ~ (the home directory). zsh prompt should read

    hostname:username @ user $

  2. cd dev/repo takes me into a git repo, zsh prompt should read

    hostname:username @ repo $ (master)

  3. cd .. takes me back to dev, which isn't a git repo, prompt should read

    hostname:username @ dev $

I experience:

The prompt never changes / updates automatically; I have to run source ~/.zshrc to make the prompt update as I change directories.

Perhaps I'm missing something; can someone point out what the issue could be? Thanks!