A Pro Terminal on macOS
iTerm2, Zsh and Powerlevel10k for DevOps and SRE
Turn your terminal into an infrastructure cockpit: a prompt that shows your Kubernetes context, plugins that remove repetitive typing, and visual cues that help you avoid running a command against the wrong environment.
Introduction
If you work as a DevOps or SRE engineer on macOS, the terminal is where you deploy containers, talk to Kubernetes, run Terraform and investigate incidents. A good configuration will not make you a better engineer, but it removes friction and makes the current context visible before you press Enter.
This guide sets up iTerm2, Zsh, Oh My Zsh and Powerlevel10k, then adds the Kubernetes tools kubectx, kubens and k9s. Every command, alias and key binding was checked against the official repositories and documentation listed at the end of the page. Treat the choices as suggestions and adapt them to your team.
Read this first: the Powerlevel10k README states that the project has very limited support, that no new features are planned and that most bugs will go unfixed. It still works for many people, but you should know this before you build your workflow on it. Alternatives exist, so evaluate them before you commit.
Prerequisites: Homebrew and Zsh
Homebrew installs most of the tools in this guide. The commands assume you use Zsh: run echo $SHELL to check.
Install Homebrew
Homebrew is a package manager for macOS. This is the installation command given in the official Homebrew installer repository. Read a script before you pipe it into a shell, and check the official documentation for the current requirements (Homebrew lists the Xcode Command Line Tools as a requirement for building formulae from source).
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Note: when the installer finishes it prints “Next steps”. Run the commands it shows so that brew is on your PATH.
Install iTerm2 and the font
iTerm2 is a terminal emulator for macOS that offers split panes, profiles and search. Powerlevel10k draws icons that need a font with extra glyphs.
Install iTerm2
$ brew install --cask iterm2
Install the MesloLGS NF font
Powerlevel10k recommends the font MesloLGS NF. Without a suitable font, some icons in the prompt are drawn as broken characters. The Powerlevel10k README describes two ways to install it:
- Automatic, iTerm2 only: when you run
p10k configurelater in this guide, answer Yes when it asks whether to install Meslo Nerd Font. - Manual: download the four
.ttffiles linked in the “Manual font installation” section of the Powerlevel10k README, double-click each one and click Install. Then open iTerm2, press Cmd + , to open the preferences, go to Profiles then Text and set Font toMesloLGS NF.
Tip: create a second profile named “Production” with a clearly different background color and use it only for production sessions. This is a visual cue, not a safeguard: it does not stop a dangerous command from running. Real safeguards are separate credentials, read-only roles and reviewed pipelines.
Oh My Zsh, Powerlevel10k and two Zsh add-ons
Oh My Zsh is a framework that manages Zsh configuration, plugins and themes. Powerlevel10k is a Zsh theme that draws the prompt.
Install Oh My Zsh
This is the command from the Oh My Zsh README. The installer keeps your previous ~/.zshrc as ~/.zshrc.pre-oh-my-zsh and creates a new one.
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Install Powerlevel10k
Use the Oh My Zsh method from the Powerlevel10k README:
$ git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
Then set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc (the full file is shown in the next section). Homebrew also has a powerlevel10k formula, but do not install the theme both ways: pick one.
Install the tools used by the configuration
These two add-ons are installed with Homebrew and sourced from ~/.zshrc. The optional thefuck corrects mistyped commands.
$ brew install zsh-autosuggestions zsh-syntax-highlighting
$ brew install thefuckA ~/.zshrc for SRE work
Edit your existing file instead of overwriting it. The order of the lines matters.
First make a backup, then open the file in your editor:
$ cp ~/.zshrc ~/.zshrc.bak
$ open -e ~/.zshrc
Make the relevant parts look like this. The instant prompt block must stay at the very top, and zsh-syntax-highlighting must be the last thing sourced, as its documentation requires. If you run p10k configure later, the wizard adds the instant prompt block and the ~/.p10k.zsh line for you.
# Powerlevel10k instant prompt: keep this block at the very top of ~/.zshrc
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Oh My Zsh location and theme
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
# Oh My Zsh plugins (explained in the next section)
plugins=(git z sudo docker docker-compose kubectl helm terraform aws brew macos command-not-found history-substring-search colored-man-pages copypath extract safe-paste gitignore)
source $ZSH/oh-my-zsh.sh
# The Fuck (optional): defines the "fuck" alias
command -v thefuck >/dev/null && eval "$(thefuck --alias)"
# Aliases that the plugins above do not provide
alias kctx="kubectx"
alias kns="kubens"
alias lzd="lazydocker"
# Autosuggestions (HOMEBREW_PREFIX is set by the brew plugin)
source "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
# Powerlevel10k configuration, created by "p10k configure"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# zsh-syntax-highlighting must be sourced last
source "$HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
Restart Zsh to apply the changes. The Powerlevel10k README warns against source ~/.zshrc and recommends restarting Zsh instead:
$ exec zsh
Two choices explained. First, the thefuck Oh My Zsh plugin and the sudo plugin both bind the Esc key pressed twice, and the plugin’s own README notes the conflict. This guide keeps sudo and defines the fuck alias directly. Second, the kubectl, helm and terraform plugins already provide completion and many aliases, so there are no manual completion lines and no hand-written k, kgp or tf aliases.
What each Oh My Zsh plugin gives you
Every plugin below has a README in the Oh My Zsh repository under plugins/. Read the README of a plugin before you rely on it, because aliases can be more powerful than they look.
Git, navigation and sudo
git: aliases for Git
The plugin defines a large set of aliases. Some common ones:
$ gst
# git status
$ ga .
# git add .
$ gcmsg "fix: kubectl timeout issue"
# git commit --message "..."
$ gp
# git push
Run alias | grep git to list them all, or read the plugin README.
z: jump to frequently used directories
The plugin provides the z command, which tracks the directories you visit and lets you jump to one with a partial name. It only knows directories you have already visited:
$ z prod-eu1
sudo: press Esc twice
If you typed a command and forgot sudo, press the Esc key twice. The plugin prefixes the current command line with sudo. If the command line is empty, it does the same with the previous command.
Prediction and history
zsh-autosuggestions: suggestions from your history
As you type, the tool shows a grayed-out suggestion based on your history. Press the right arrow or End key to accept it (with the cursor at the end of the line). This is not a plugin in the plugins array: you installed it with Homebrew and sourced it in ~/.zshrc.
history-substring-search: search history with the arrow keys
Type any part of a previous command, then press the Up arrow. The plugin binds the terminal’s Up and Down keys and cycles through history entries that contain what you typed.
$ kubectl logs
# press Up to cycle through matching commands from your history
thefuck: correct the previous command
After a failed command, type fuck. The tool proposes a corrected command and asks for confirmation. This example comes from the project README:
$ git brnch
git: 'brnch' is not a git command. See 'git --help'.
$ fuck
git branch [enter/↑/↓/ctrl+c]
Always read the proposed command before you press Enter. The tool guesses, and a wrong guess on a destructive command is your responsibility.
Docker, Kubernetes and Terraform
docker, docker-compose, kubectl, helm, terraform
These plugins add Tab completion and aliases. Examples from their READMEs:
$ k get pods
# k is an alias for kubectl
$ kgp
# kubectl get pods
$ kgpa
# kubectl get pods --all-namespaces
$ tfp
# terraform plan
$ dps
# docker ps
Warning: the terraform plugin also defines tfd (terraform destroy), tfd! (terraform destroy -auto-approve) and tfa! (terraform apply -auto-approve). The kubectl plugin defines delete aliases such as kdel. Short aliases for destructive commands are convenient and dangerous, so read the alias tables and consider unaliasing the ones you do not want.
Utilities
command-not-found: package suggestions
On macOS the plugin loads the Homebrew command-not-found handler when it is present. If Homebrew knows which formula provides the missing command, the shell prints an install suggestion. The Homebrew documentation gives this kind of output, and says the handler never installs anything automatically:
$ example-command
The program 'example-command' is currently not installed. You can install it by typing:
brew install example-formula
If Homebrew finds no match, you get the normal “command not found” error.
colored-man-pages
Adds colors to man pages, for example man kubectl. You can also try colored git help clone on other pages.
extract: one command for many archive types
Instead of remembering the right flags for each format, run extract on the file. The README lists the supported extensions.
$ extract backup.tar.gz
$ extract config.zip
$ extract archive.7z
safe-paste: review before you run
Pasted text is inserted into the command line instead of being executed immediately, so you can review what you pasted before you press Enter. This matters when you paste a snippet from a web page.
copypath: copy the current path
$ copypath
# copies the absolute path of the current directory to the clipboard
$ copypath deploy.yaml
# copies the absolute path of that file
gitignore: templates from gitignore.io
The plugin fetches .gitignore templates, so it needs an Internet connection. Preview a template, then append it to your file:
$ gi list
$ gi terraform
$ gi terraform python macos >> .gitignore
Cloud and macOS
aws
Adds completion for AWS CLI v2 and helpers to manage profiles and regions: asp sets the active profile, asr sets the region, agp and agr print the current values. Completion covers commands and options, not the names of your resources.
$ asp my-profile
# sets AWS_PROFILE for this shell
brew
Adds aliases for common Homebrew commands (for example bi for brew install, bo for brew outdated, bdr for brew doctor) and sets HOMEBREW_PREFIX, which the .zshrc above relies on.
macos
Adds macOS helpers. Some of them, from the plugin README:
$ ofd
# open the current directory in Finder
$ quick-look report.pdf
# Quick Look preview of a file
$ rmdsstore
# remove .DS_Store files recursively in a directory
Configure Powerlevel10k and make production visible
Powerlevel10k has a configuration wizard, and it can color the Kubernetes context differently for production.
Run the wizard. It also offers to install the recommended font in iTerm2:
$ p10k configure
Choose the prompt style you find readable. If you show the time in the prompt, a 24-hour format is easier to compare with logs and dashboards, whichever time zone your team uses. The wizard writes ~/.p10k.zsh. You can run it again at any time.
What the Kubernetes segment shows, and when
The configuration files shipped with Powerlevel10k include segments for the Kubernetes context (kubecontext), the Terraform workspace (terraform) and the AWS profile (aws). By default, several of them are shown only while the command you are typing uses a related tool. In the shipped Classic config, the Kubernetes context appears when you type commands such as kubectl, helm, kubens, kubectx or k9s, and the AWS profile appears for commands such as aws and terraform. The config file says you can remove the SHOW_ON_COMMAND line to show a segment all the time.
Color production contexts differently
Red for production is not the default. The default config only has a commented example. To enable it, edit ~/.p10k.zsh, find the POWERLEVEL9K_KUBECONTEXT_CLASSES array and uncomment or add a pattern that matches your production context names. Colors are numbers from the 256-color palette:
typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
'*prod*' PROD
'*' DEFAULT)
typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_FOREGROUND=196
The pattern '*prod*' only works if your contexts have “prod” in their name. Adapt it to your naming convention, then restart Zsh with exec zsh.
Limit of this technique. A colored prompt tells you where you are, but only if you look at it. Use it together with separate credentials per environment and a review step before production changes.
A ready-to-copy ~/.p10k.zsh
A compact, hand-maintained alternative to running the wizard: drop this in, adjust the colors to taste, then restart Zsh.
This file only sets what the setup on this page actually uses: the segments tied to the plugins introduced above (Git, Kubernetes, Terraform, AWS). It is not the full file the wizard writes, which documents every available segment with extensive comments; run p10k configure for that, or see the Powerlevel10k README, linked under “Official documentation” below, for the complete option reference.
# ~/.p10k.zsh
# Hand-maintained companion to the ~/.zshrc from "A ~/.zshrc for SRE work" above.
# Sourced automatically by: [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Only sets what that setup actually uses (git, kubectl, terraform, aws).
# Run "p10k configure" instead if you want the wizard, or to see every
# available segment and option.
# Temporarily change shell options so the settings below behave the same
# way regardless of what is already set in the interactive shell.
'builtin' 'local' '-a' 'p10k_config_opts'
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
() {
emulate -L zsh -o extended_glob
unsetopt 'aliases'
# Stop p10k from launching the wizard automatically now that this file exists.
typeset -g POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
# Silence the informational message the instant-prompt feature prints once.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
# Requires the Nerd Font from "Install iTerm2 and the font" above.
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
typeset -g POWERLEVEL9K_ICON_PADDING=moderate
# -----------------------------------------------------------------
# Prompt layout
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
os_icon # OS logo
dir # current directory
vcs # git branch and status
newline # commands start at the left margin
prompt_char # a single character, red after a failed command
)
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
status # exit code of the last command, only when non-zero
command_execution_time # duration, only above the threshold below
background_jobs # count of background jobs, if any
context # user@host
kubecontext # kubectl context, only for kubectl-family commands
terraform # Terraform workspace, only for terraform commands
aws # AWS_PROFILE, only for aws and terraform commands
time # HH:MM:SS, 24-hour
)
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
# -----------------------------------------------------------------
# dir
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
typeset -g POWERLEVEL9K_DIR_FOREGROUND=31
# -----------------------------------------------------------------
# vcs (git)
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76
typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178
typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=178
typeset -g POWERLEVEL9K_VCS_CONFLICTED_FOREGROUND=196
# -----------------------------------------------------------------
# status / command_execution_time / background_jobs
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_STATUS_OK=false
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=231
typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=196
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=37
# -----------------------------------------------------------------
# context (user@host)
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m'
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=231
typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=196
# -----------------------------------------------------------------
# kubecontext
# See "Configure Powerlevel10k and make production visible" above for
# what SHOW_ON_COMMAND and the *_CLASSES pattern do.
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|k9s|stern|flux|skaffold'
typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
'*prod*' PROD
'*' DEFAULT)
typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_FOREGROUND=196
typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_VISUAL_IDENTIFIER_EXPANSION='!'
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=66
# -----------------------------------------------------------------
# terraform / aws
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_TERRAFORM_SHOW_ON_COMMAND='terraform|tf'
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=105
typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|terraform|tf'
typeset -g POWERLEVEL9K_AWS_FOREGROUND=208
# -----------------------------------------------------------------
# time
# -----------------------------------------------------------------
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
typeset -g POWERLEVEL9K_TIME_FOREGROUND=66
}
# Restore the shell options changed above.
(( ! ${#p10k_config_opts} )) || setopt ${p10k_config_opts[@]}
'builtin' 'unset' 'p10k_config_opts'
Back up any existing file first, save the content above as ~/.p10k.zsh, then restart Zsh. The ~/.zshrc line from the previous section, [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh, sources it automatically:
$ cp ~/.p10k.zsh ~/.p10k.zsh.bak 2>/dev/null; true
$ open -e ~/.p10k.zsh
# paste the content above, save, then:
$ exec zshScope. This starting point covers the tools already documented on this page. Powerlevel10k has many more segments (Python virtualenv, Node version, battery, time since last Git commit, and others); add them to the LEFT or RIGHT prompt arrays above once you need them, or run p10k configure to explore them interactively.
iTerm2 tips for incidents
These shortcuts come from the iTerm2 menu definitions in the official source repository.
Split panes
During an incident you often watch several things at once, such as application logs next to a metrics query.
- Cmd + D: split the current pane vertically (menu item “Split Vertically with Current Profile”).
- Cmd + Shift + D: split the current pane horizontally (“Split Horizontally with Current Profile”).
- Cmd + Option + arrow keys: select the pane above, below, left or right.
- Cmd + ] and Cmd + [: select the next and previous pane.
Profiles per environment
- Press Cmd + , to open the preferences and go to Profiles.
- Create a new profile and name it Production.
- In the color settings of that profile, choose a clearly different background.
- Use this profile only for production sessions.
Search the terminal output
Cmd + F opens Find in the current session, which is useful to locate an earlier command or an error message in a long output.
More aliases, with a warning
Check the plugin READMEs first: many aliases you would write already exist.
# Only add aliases that no plugin already provides
alias kctx="kubectx"
alias kns="kubens"
alias lzd="lazydocker"
# A readable docker ps (uses the "table" format from the Docker CLI docs)
alias dpst='docker ps --format "table {{.Names}}t{{.Status}}t{{.Ports}}"'
Two details. The name lzd is the alias suggested in the lazydocker README. Avoid ld for lazydocker, because ld is already the name of the system linker. And think twice before you alias a destructive command: an alias that runs terraform destroy in three keystrokes is a risk, not a shortcut.
Maintenance and updates
Keep the tools up to date, but read what changes before you upgrade tools you depend on.
Regularly
brew update refreshes the package index and brew upgrade upgrades installed formulae and casks, including iTerm2 and the Zsh add-ons.
$ brew update && brew upgrade
Oh My Zsh
The Oh My Zsh README documents the omz update command.
$ omz update
Powerlevel10k
The update command depends on how you installed it. For the Oh My Zsh method used in this guide, the README gives this command. Restart Zsh afterwards.
$ git -C "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k" pull
Kubernetes tools: kubectx, kubens, k9s and lazydocker
Three tools are useful every day with Kubernetes: kubectx, kubens and k9s. lazydocker is an optional terminal UI for Docker.
kubectx and kubens: switch context and namespace
Both tools come from the same repository. The Homebrew formula kubectx installs both commands.
$ brew install kubectx
Usage, following the examples in the project README:
$ kubectx staging
Switched to context "staging".
$ kubectx -
# switch back to the previous context
$ kubens kube-system
Context "staging" set.
Active namespace is "kube-system".
$ kubens -
# switch back to the previous namespace
Both commands support Tab completion in Zsh. If you install fzf, running kubectx or kubens without arguments opens an interactive menu with fuzzy search. Without fzf, the commands do not present that menu. Set KUBECTX_IGNORE_FZF=1 to opt out of the menu when fzf is installed.
$ brew install fzf
Remember: switching context changes what every later kubectl and helm command targets. With the production highlighting from the Powerlevel10k section, the prompt shows the change as soon as you start typing a Kubernetes command.
k9s: a terminal UI for Kubernetes
k9s is a terminal UI that continuously watches a cluster and lets you navigate, view and manage resources with keyboard commands.
$ brew install k9s
$ k9s
Some key bindings from the k9s README:
- ?: show the key bindings available in the current view
- :pod then Enter: open the pods view (the same works for other resources, for example
:deployor:svc) - / followed by a filter: filter the current view
- l: view the logs of the selected resource
- d: describe the selected resource
- y: view the YAML of the selected resource
- s: open a shell in the selected container (pods only)
- e: edit the selected resource (not available in read-only mode)
- :ctx and :ns: switch context or namespace
- Ctrl + d: delete the selected resource (confirmation required)
- Esc: go back to the previous view
Warning: k9s can delete resources and edit manifests. Before you open it on a production cluster, check the context in your prompt. The README documents a read-only mode that you can start with k9s --readonly, which is a good default for observation.
# Optional: open k9s on a given context (adapt the context name)
alias k9s-staging="kubectx staging && k9s"
alias k9s-prod="kubectx prod-eu1 && k9s --readonly"
lazydocker: a terminal UI for Docker (optional)
According to its README, lazydocker lets you view the state of your Docker or Docker Compose environment at a glance, view container logs and resource metrics, and restart, remove or rebuild containers and services. It needs a working Docker installation.
$ brew install lazydocker
$ lazydocker
It is aimed at local development and debugging. For production clusters, Kubernetes tools such as k9s are the relevant ones.
Summary
| Tool | Use | Install |
kubectx |
Switch between Kubernetes contexts | brew install kubectx |
kubens |
Switch between namespaces | brew install kubectx |
k9s |
Watch and manage a cluster in a terminal UI | brew install k9s |
lazydocker |
Manage local Docker containers (optional) | brew install lazydocker |
Other DevOps and SRE tools
The commands below install common command-line tools with Homebrew.
Terraform and the HashiCorp tap
Terraform is not in the main Homebrew repository (homebrew-core). It comes from the HashiCorp tap, which also provides other HashiCorp tools such as Vault and Packer:
$ brew tap hashicorp/tap
$ brew install hashicorp/tap/terraform
A general toolset
$ brew install git kubernetes-cli helm awscli checkov jq yq
These formulae exist in the main Homebrew repository. kubernetes-cli provides kubectl. To run containers you also need a container engine, for example Docker Desktop (Homebrew cask docker-desktop). The Homebrew docker formula is built from the Docker CLI repository, so it provides the command-line client only.
Optional: TFLint
The TFLint README lists this Homebrew command, as well as downloads from its GitHub releases page:
$ brew install terraform-linters/tap/tflint
Check the installation
$ terraform version
$ kubectl version --client
$ helm version
$ aws --version
The output depends on the versions installed on your Mac.
What you have now
After following this guide you have:
- iTerm2 with split panes and a Production profile as a visual cue
- Powerlevel10k showing your Kubernetes context, Terraform workspace and AWS profile when they are relevant
- Oh My Zsh plugins for Git, Docker, Kubernetes, Helm, Terraform, AWS and Homebrew, with completion and aliases
- zsh-autosuggestions and zsh-syntax-highlighting for faster and safer command entry
- kubectx, kubens and k9s to switch and observe clusters quickly
- Read the plugin READMEs for the aliases you actually use, and unalias the ones you do not want.
- Press
?in k9s to explore its key bindings and its configuration options. - Define a naming convention for your Kubernetes contexts so that the production pattern in Powerlevel10k always matches.
Official documentation
- Homebrew: installation
- Homebrew: command-not-found handler
- Oh My Zsh (README)
- Oh My Zsh: plugins (one README per plugin)
- Powerlevel10k (README)
- zsh-autosuggestions (README)
- zsh-syntax-highlighting (installation)
- The Fuck (README)
- iTerm2 source repository (main menu definition with the shortcuts)
- kubectx and kubens (README)
- k9s (README)
- lazydocker (README)
- Docker CLI reference: docker container ls
Keep going
iTerm2, Zsh and Powerlevel10k setup for SRE and DevOps on macOS, by Seif. Last reviewed: September 2026. The commands, aliases and key bindings were checked against the official repositories and documentation listed on this page, not on every macOS version, so check the documentation for your versions.
benmabrouk.fr: free DevOps and SRE learning resources, written from real-world experience.