ZSH and the Pure Prompt

When I updated my MacBook Pro to Catalina to try out the new SwiftUI Canvas feature in Xcode 11, it updated the shell in Terminal from Bash to ZSH.

I am not a heavy user of the Terminal, but I still noticed this change right away because all of the sudden my prompt was ugly and verbose.

I spend enough time working with git via the command line that I knew immediately that I had to fix this.

As I was researching how to change the ZSH prompt, I discovered Pure, a custom prompt that claimed to be a “pretty, minimal and fast ZSH prompt”. I installed it and tried it out.

It splits the prompt onto two lines. The top line shows your current directory path, and the second is your prompt, which is represented simply by the character.

The real power of Pure comes in when you navigate to a directory that is part of a git repository.

To the right of the directory, it shows the repository’s git status:
master: The current branch.
*: Working copy has uncommitted changes.
: There are commits that have not been pushed.
: There are commits are available to pull.

Since the main thing I use Terminal for is quick git actions, sticking with Pure was a no-brainer. I even switched to ZSH on my work iMac (that is still running Mojave) so I could use it there over the summer.


If you want to try it out, first make sure you are using ZSH. If you are on Catalina, you should be all set here. If not you can still make ZHS your shell by following these instructions from Apple (hat tip to Stephen Hackett for that link).

Once you are running ZSH, open Terminal and install pure-prompt using npm.

npm install --global pure-prompt

After that, add some simple loading instructions to ~/.zshrc

autoload -U promptinit; promptinit
prompt pure

After restarting Terminal, you will be all set.


The only negative thing that I have found with Pure is that clearing the screen using ⌘K no longer works properly (it cuts off the first line that shows the current directory).

I was able to work around this by switching to clearing my screen with ⌃L instead.