When I get my hands on a new mac, I always forget how to set up the terminal the way I like. So, in this post, I’ll go through the steps I take to set up my terminal to get it looking all fancy with syntax highlighting and autocomplete etc.
iTerm
Install latest iTerms https://iterm2.com/downloads.html
Install Oh My Zsh
Install oh-my-zsh using curls
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Make zsh the default shell chsh -s $(which zsh)
then log out and log back in again to use your new default shell.
Set the theme
Install Powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Then enable it, change the value of ZSH_THEME to following in ~/.zshrc
file. Open using open ~/.zshrc
, save file and then restart terminal.
ZSH_THEME="powerlevel10k/powerlevel10k"
After the terminal has been restarted complete the questions to configure the theme.
Install plugins
Clone the zsh-autosuggestions repo
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc
)
plugins=(
# other plugins...
zsh-autosuggestions
)
Install zsh-syntax-highlighting
Clone the repo and source the script
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
Then, enable syntax highlighting in the current interactive shell
source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Configure VS Code
In VS code, open settings.json and add the following to set the default terminal profile and ensure icons show correctly.
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.fontFamily": "MesloLGS NF"