Zsh is a powerful, customizable shell that replaces the default bash on macOS.
With a couple of simple steps you can improve autocompletion, syntax highlighting, and overall comfort when working in the terminal.
1. Installing Zsh and the basic plugins
Open the terminal and install the required packages:
brew install zsh
brew install zsh-autosuggestions zsh-syntax-highlighting
Homebrew is a package manager for macOS. If it isn’t installed, run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. Installing Oh My Zsh
Oh My Zsh is a framework on top of Zsh that makes working with plugins and themes easier.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
After installation, a new terminal session opens with the robbyrussell theme (the default).
3. Configuring .zshrc
Open the configuration file:
nano ~/.zshrc
Add or verify the following lines:
# Oh My Zsh standard section
plugins=(git kubectl)
# Autosuggestions
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# Syntax highlighting
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Important: the line with zsh-syntax-highlighting must come last, otherwise highlighting may not work.
4. Installing the Powerlevel10k theme (optional)
Powerlevel10k is a modern, fast theme for Zsh with support for icons, Git status, and system information.
Installation:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Add to .zshrc:
ZSH_THEME="powerlevel10k/powerlevel10k"
After saving the file, run:
source ~/.zshrc
On first launch, Powerlevel10k offers an interactive configuration of its appearance.
You can run it again at any time:
p10k configure
Tip: install fonts with icon support (for example, MesloLGS NF) and select them in your terminal.
5. Applying the changes
Restart the terminal or run:
source ~/.zshrc
6. Verifying it works
- Start typing a command you’ve already entered before.→ a gray suggestion appears on the right — that’s zsh-autosuggestions.
- If the command is valid, it’s highlighted in green; errors are shown in red.→ that’s zsh-syntax-highlighting at work.
- If Powerlevel10k is installed, you’ll see a nice, informative prompt with icons.
Done!
Now you have a configured, fast, and informative Zsh shell
with autocompletion, highlighting, and handy plugins.
Try typing kubectl get p — if a pods suggestion appears, then everything works!