Powerlevel10k: A Better Terminal Prompt for macOS
How I configure iTerm with Powerlevel10k for git status, execution time, and environment context in my prompt.
I got tired of running git status constantly. Powerlevel10k shows branch, dirty state, and ahead/behind counts right in the prompt. It also shows command execution time, exit codes, and environment context (kubectl, virtualenv, aws profile).
Here's how to set it up on macOS.
Prerequisites
iTerm2: Download from iterm2.com
Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Oh My Zsh:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Install Powerlevel10k
brew install romkatv/powerlevel10k/powerlevel10k
Edit ~/.zshrc and change the theme:
ZSH_THEME="powerlevel10k/powerlevel10k"
Apply changes:
source ~/.zshrc
Configure It
The configuration wizard starts automatically. If not:
p10k configure
The wizard asks about:
- Prompt style (classic, rainbow, lean, pure)
- Character set (unicode icons or ASCII)
- Time format
- Separators and spacing
Pick what you like. You can run p10k configure again anytime.
Install the Font
Powerlevel10k uses special characters for icons. Without the right font, you'll see placeholder boxes.
brew tap homebrew/cask-fonts
brew install --cask font-meslo-lg-nerd-font
In iTerm: Preferences โ Profiles โ Text โ Font โ MesloLGS NF
What I Get in My Prompt
- Git branch with dirty/clean indicator
- Ahead/behind commit counts
- Command duration for commands over 3 seconds
- Exit code when commands fail
- kubectl context when in directories with Kubernetes files
- Python virtualenv when activated
- AWS profile when set
All this renders instantly. Powerlevel10k is async and cached - no noticeable delay.
Customization
Everything configurable is in ~/.p10k.zsh. You can:
- Enable/disable segments
- Change colors
- Adjust spacing
- Add custom segments
Key Takeaways
- Powerlevel10k eliminates constant
git statuscommands - Install the Meslo Nerd Font or icons won't display
- Run
p10k configureto customize the prompt style - Configuration lives in
~/.p10k.zshfor fine-tuning - Async rendering means no prompt delay even in large repos
- Back up
.p10k.zshto replicate your setup on new machines
Written by Bar Tsveker
Senior CloudOps Engineer specializing in AWS, Terraform, and infrastructure automation.
Thanks for reading! Have questions or feedback?