In macOS Catalina the new default shell is now zsh
. After upgrading, you might see the following message when you open up terminal:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
Some of you may already use zsh! If so, congratulations, this article is worthless to you. However, if you're an old bash holdout like me, read on. This is how I upgraded my setup.
First, we'll run the command like the warning states:
chsh -s /bin/zsh
Enter the sudo password and the command should change the shell. Nothing will be different until you open a new terminal window.
I like to use a status line plugin called Powerline to track things like the git branch and repository state in the terminal prompt. So first we'll install powerline with
pip3 install powerline-status
Next copy the following into your ~/.zshrc
file:
# Powerline
# https://github.com/powerline/powerline
. /usr/local/lib/python3.7/site-packages/powerline/bindings/zsh/powerline.zsh
The defaults for powerline are usually fine for me, except I don't like the right column, so to disable that, go to the file at .config/powerline/themes/shell/default.json
and clear out the "right"
section:
"right": []
Now we'll make sure we have git completion enabled in zsh, run brew install git zsh-completion
and copy the following into your .zshrc
file
# Enable git autocomplete, first make sure homebrew is installed,
# then run `brew install git zsh-completion`
# make sure you do not miss the "git" part of the command!
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
autoload -Uz compinit
compinit
fi
Now you should be all set up! Note that if you want to see my exact config, my dotfiles are always available here