How to customise your Mac terminal with ZSH and PowerLevel10k
Add some style and extra functionality to your terminal
For all new developers learning how to code on their macOS machines, the default command line interface (CLI) they will use is the Mac Terminal:
While fully functional and unlocking powerful capabilities that the GUI cannot provide, the default theme lacks style and additional capabilities that we can add to the terminal — using Z shell (ZSH) and the many popular open source plug-ins and themes it comes with.
This guide shows how to customise iTerm2 with ZSH and PowerLevel10k
- Open up the default Mac Terminal
- Install Homebrew — Homebrew is a package manager that helps simplify the installation of software on our MacOS (or Linux) operating system
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3. Install iTerm2 — iTerm2 is a better alternative to the Terminal.
brew cask install iterm2
4. Open iTerm2
5. Install the Oh My Zsh Zsh framework using curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
6. Now run the following:
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
7. Open your ~/.zshrc file to edit. This should be in your home directory (navigate to home directory with cd~).
open ~./zshrc
8. Edit the file, setting the theme to “powerlevel10k/powerlevel10k”. Here is a guide for this step.
ZSH_THEME="powerlevel10k/powerlevel10k"
It should look like this:
Save the file.
9. Now close iTerm2 and reopen it. Your terminal should now be updated with a new look. You should now be prompted to install fonts, choose yes and then continue with the configuration wizard to finish the setup.
(The font installed on my machine was MesloLGS NF)
Refer to https://github.com/romkatv/powerlevel10k#manual for more information on Powerlevel10k.
For reference the guide I followed is available here:
https://www.youtube.com/watch?v=pTW02GMeI74
https://gist.github.com/kevin-smets/8568070
Happy coding!
-Hugh
I am a junior developer in training at CoderAcademy in Sydney, Australia. My interests are in programming, economics, trading and Bitcoin. Follow me on Twitter @hughgreethead