Basically, this post is here to share the upgrades I’ve made to my Terminal after an hour of exploration today. The core of it involves using OhMyZsh to customize certain features and make the Terminal experience more user-friendly.
While the default Zsh in macOS is powerful, its out-of-the-box configuration is extremely minimal. Oh My Zsh is not just a framework; it’s a vast ecosystem of plugins and themes.
Auto-completion
For my terminal usage, I installed the zsh-autosuggestions plugin, which provides “gray ghost” predictions based on my command history.
- Installation Command:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions - User Experience: When you type just
gi, the terminal already suggests the completion for that complexgit clonecommand. Using the right arrow key→significantly boosts efficiency. - Configuration: Edit
~/.zshrcand addzsh-autosuggestionsto theplugins=(...)array.
Using VS Code instead of Nano
On macOS, you can use the following command to open the configuration file directly:
code ~/.zshrc
If the command is not found, press Cmd + Shift + P in VS Code, search for and run Shell Command: Install 'code' command in PATH.
Switching to Ghostty Terminal
I migrated from the traditional Terminal.app to Ghostty. This is a modern, GPU-accelerated terminal written in Zig.
- Installation: Install via Homebrew using
brew install --cask ghostty. - Config Path: The configuration file is located at
~/.config/ghostty/config. - Key Visual Parameters:
font-family = "JetBrains Mono"
font-size = 14
theme = "Catppuccin Mocha"
background-opacity = 0.85
background-blur-radius = 20
cursor-style = bar
cursor-style-blink = true
window-decoration = true
Introducing the Starship Prompt
To further enhance status display, I integrated Starship. It is a cross-shell prompt that displays Git status, command execution time, and tool versions in real-time.
- Installation & Initialization:
The installation command is
brew install starship. Add the initialization scripteval "$(starship init zsh)"to the end of your~/.zshrc. - Applying Presets:
Apply the colorful powerline preset with the following command:
starship preset pastel-powerline -o ~/.config/starship.toml
Optimizing Startup with Powerlevel10k
While I use Starship for the visual prompt, the underlying Zsh theme remains Powerlevel10k to leverage its performance features.
- Instant Prompt: Adding
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quietto the very first line of~/.zshrceliminates redundant output warnings during initialization and achieves near-instant startup. - Environment Path Management: Use
export PATH="$HOME/.local/bin:$PATH"to ensure all local CLI tools are correctly mapped.
Syntax Highlighting
The final configuration is zsh-syntax-highlighting. It provides real-time feedback on the commands you type.
- Installation Command:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting - Configuration: Add
zsh-syntax-highlightingto thepluginslist in~/.zshrc. - Functionality:
- Green: The command is valid.
- Red: The command is misspelled, allowing for immediate correction.
My .zshrc
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
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
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export PATH="$HOME/.local/bin:$PATH"
eval "$(starship init zsh)"