Z shell comes pre-bundled with macOS Catalina (10.15) and above. This guide will help you configure zsh with code-completion, useful aliases and theming.
Note: ignore if you are using macOS 10.15+
If you are using an earlier macOS version, you will need to install zsh manually.
-
Make sure you have installed Homebrew on your system - if not, read the Homebrew guide;
which brew
-
Open terminal and run the following command:
brew install zsh
-
Restart your terminal.
Oh my zsh is a plugin system for zsh that allows you to easily expand your terminal with additional features.
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Powerlevel10k is an excellent theme for zsh.
-
Download and install the Meslo Nerd Font on your local machine.
Double-click on each file and click "Install".
-
Configure your terminal to use the Meslo Nerd Font.
Open Terminal → Preferences → Profiles and select
MesloLGS NF
from the Text dropdown.Open iTerm2 → Preferences → Profiles → Text, click Change under Font and select
MesloLGS NF
family.I suggest to also change the font-size to
13px
. -
Download Powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
-
Enable Powerlevel10k in
~/.zshrc
Edit
~/.zshrc
with your editor and set the following variable.ZSH_THEME="powerlevel10k/powerlevel10k"
-
Configure Powerlevel10k theme (if it doesn't automatically trigger the configuration wizard)
p10k configure
Plugins are mostly meant for code completion. If you are a JavaScript developer like me, you could start with the following.
git
npm
yarn
extract
Aliases adhere to each developer's personal preference. My only suggestion would be to use the following.
alias ll="ls -la"
- Open
~/.zshrc
with your favourite editor. - Append the lines above either at the end of the file or at the relevant section.
If you prefer NOT to share history between tabs in your terminal, add the following lines to your ~/.zshrc
after source $ZSH/oh-my-zsh.sh
.
unsetopt inc_append_history
unsetopt share_history