In macOS Catalina the new default shell is now zsh
. After upgrading, you might see the following message when you open up terminal:
1The default interactive shell is now zsh.2To update your account to use zsh, please run chsh -s /bin/zsh.3For more details, please visit https://support.apple.com/kb/HT208050.
1The default interactive shell is now zsh.2To update your account to use zsh, please run chsh -s /bin/zsh.3For 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:
1chsh -s /bin/zsh
1chsh -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
1pip3 install powerline-status
1pip3 install powerline-status
Next copy the following into your ~/.zshrc
file:
1# Powerline2# https://github.com/powerline/powerline3. /usr/local/lib/python3.7/site-packages/powerline/bindings/zsh/powerline.zsh
1# Powerline2# https://github.com/powerline/powerline3. /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:
1"right": []
1"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
1# Enable git autocomplete, first make sure homebrew is installed,2# then run `brew install git zsh-completion`3# make sure you do not miss the "git" part of the command!4if type brew &>/dev/null; then5 FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH67 autoload -Uz compinit8 compinit9fi
1# Enable git autocomplete, first make sure homebrew is installed,2# then run `brew install git zsh-completion`3# make sure you do not miss the "git" part of the command!4if type brew &>/dev/null; then5 FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH67 autoload -Uz compinit8 compinit9fi
Now you should be all set up! Note that if you want to see my exact config, my dotfiles are always available here