By Manny Fernandez

October 2, 2026

Quick Tip:  Renaming your zsh prompt on your macOS

Quick Tip: Renaming your zsh prompt on your macOS

Quick-Tip

The default macOS zsh prompt prints your username, your hostname, the current folder, and a percent sign. On a laptop named Mannys-MacBook-Pro-M4 that is 40 characters gone before you type anything. Here is how to shorten it with one line, and why that one line will never slow down iTerm2.

Objective: Replace the long default prompt with a short one and keep shell startup fast.

Audience: Anyone living in iTerm2 or Terminal on macOS with the stock zsh shell.

Time: Two minutes.

The Problem

This is what macOS gives you out of the box:

mannyfernandez@Mannys-MacBook-Pro-M4 ~ %

That comes from the system default PROMPT='%n@%m %1~ %# '. Split a pane in iTerm2 and half the line is prompt.

The common fear is that touching ~/.zshrc makes the terminal slow to open. It does not. Setting a prompt is a single variable assignment with zero measurable cost. If your terminal crawled after a past edit, the cause was something else in that file: a framework, a plugin manager, or a tool that runs a subprocess on every launch. More on that below.

The Fix

Step 1: Try it in the current session

Paste this straight into your terminal. It changes the prompt for this tab only, so nothing is permanent yet.

PROMPT='%1~ %# '

Your prompt is now the current folder name and the percent sign, for example ~ % or Documents %.

Step 2: Make it permanent

Append the line to ~/.zshrc and reload:

echo "PROMPT='%1~ %# '" >> ~/.zshrc
source ~/.zshrc

Open a new iTerm2 tab and this is all you see now:

Last login: Fri Oct  2 00:01:45 on ttys000
~ %

Four characters of prompt instead of 40, and the rest of the line is yours.

Step 3: Pick the flavor you like

PROMPT='%# '                   # just the % sign
PROMPT='%1~ %# '               # current folder only
PROMPT='%2~ %# '               # last two folders of the path
PROMPT='%F{cyan}%1~%f %# '     # current folder in color
PROMPT='%n %1~ %# '            # username + folder, no hostname

Want the full path without giving up the left side of the line? Park it on the right edge. It disappears automatically when your command gets long enough to reach it.

PROMPT='%1~ %# '
RPROMPT='%F{242}%~%f'

Prompt Escape Reference

Escape What it prints
%n Username
%m Hostname, up to the first dot
%~ Full working directory, with ~ for home
%1~ Last folder of the path only. Change the number to keep more.
%# % for a normal user, # when you are root
%F{color} … %f Start and stop a foreground color. Accepts names (cyan, red) or 0 to 255.
%B … %b Start and stop bold
%T / %* Time as HH:MM / time as HH:MM:SS
%? Exit code of the last command

Verify: Is Your Shell Actually Fast?

Time a full interactive startup:

time zsh -i -c exit

Look at the total value at the end of the output. Example of a healthy result:

zsh -i -c exit  0.04s user 0.03s system 85% cpu 0.082 total

Under about 0.2 seconds is fine. If you are well over that, the prompt is not the reason. Go find the real one.

Troubleshooting and Gotchas

1. The terminal is slow to open

Profile it. Add the first line below to the very top of ~/.zshrc and the second to the very bottom, then open a new tab.

zmodload zsh/zprof    # first line of ~/.zshrc

# ... your existing config ...

zprof                 # last line of ~/.zshrc

You get a table sorted by time spent, with the worst offender on top. Remove both lines when you are done. The usual suspects:

  • nvm. Sourcing nvm.sh can add half a second or more all by itself.
  • conda init. The block it writes runs a Python subprocess on every launch.
  • Oh My Zsh with a long plugin list. Each plugin is another file to source.
  • compinit called more than once. Frameworks call it, then a pasted snippet calls it again.
  • Any eval "$(some-tool init)" line. Every one of them forks a process before you see a prompt.

You do not have to give those tools up. Lazy-load them so the cost is paid the first time you use the tool, not every time you open a tab. Example for nvm, replacing the stock nvm lines:

nvm() {
  unset -f nvm
  export NVM_DIR="$HOME/.nvm"
  source "$NVM_DIR/nvm.sh"
  nvm "$@"
}

The tradeoff: node and npm are not on your PATH in a new tab until you run an nvm command once.

2. The prompt did not change

Something later in the file is overwriting it. Oh My Zsh themes, Starship, and Powerlevel10k all set PROMPT themselves. Last assignment wins, so either move your line to the very end of ~/.zshrc or remove the theme. Check what is live right now with:

print -r -- "$PROMPT"
grep -n "PROMPT\|PS1\|ZSH_THEME" ~/.zshrc

3. Use single quotes

Write PROMPT='...' with single quotes. Double quotes let the shell expand things once at assignment time, which bites you the moment you add a variable or a command substitution to the prompt.

The Takeaway

One line, PROMPT='%1~ %# ', gets you your screen back. It costs nothing at startup. If iTerm2 is slow to open, profile with zprof and fix the thing that is actually slow.

MacPorts vs. Homebrew: Choosing a macOS Package Manager in 2026

MacPorts vs. Homebrew: Choosing a macOS Package Manager in 2026

Compare MacPorts vs Homebrew for 2026. Learn the differences in security, architecture, and Intel support to pick the right macOS package manager for your...

Read More
IOS Focus Mode: Enabling, Configuring or Disabling it.

IOS Focus Mode: Enabling, Configuring or Disabling it.

Learn how to configure iOS Focus Mode to stop missed calls. Master every trigger, set allow lists, and permanently disable Focus so it never...

Read More
Homebrew Under the Hood: File Structure, Environment Variables and the Plumbing Behind brew

Homebrew Under the Hood: File Structure, Environment Variables and the Plumbing Behind brew

Map Homebrew file structure and environment variables. Locate Cellar kegs, understand opt symlinks, and configure shell paths for macOS and Linux.

Read More