Customize Your Terminal Prompt on macOS
Create a cleaner macOS prompt showing only the current folder and a
>
Motivation
This is for macOS using the default zsh shell (used in macOS Catalina and later).
The command prompt on macOS doesn’t look nice by default. Here’s my preferred adjustment, where the prompt shows just the current folder followed by >
.
Like this:
my-folder >
Here’s what I want the Terminal to look like on macOS (when I’m working on website/
.
And Here’s what I want it to look like in RStudio.
How to Do It
Here’s how to make the change:
- Open Terminal and run
open -a TextEdit ~/.zshrc
. This opens~/.zshrc
in TextEdit. - Add
export PS1="%1~ > "
to the bottom of the file. - Save and close TextEdit.
- Restart Terminal or run
source ~/.zshrc
to see the new prompt.
If you ever want to reset or further customize your prompt, you can edit ~/.zshrc
again and change the PS1
line.