How to Change Mac Terminal Prompt


By default the prompt that you see on your Mac Terminal is as,

Syntax:
logged-in-username@Mac-device-name Current-Directory %
Example:
c2cdev@C2cs-MacBook-Pro Desktop % 

Note that the default shell on macOS is ZSH and not Bash.


If you want to change the way the prompt looks, you can do that by adding the PROMPT details in the .zshrc file.


Steps to Change macOS Terminal Prompt:

  1. Open Terminal App
  2. Type zsh and press enter to make sure to are in the ZSH Shell.
  3. Now type nano ~/.zshrc to open this fine in Nano text editor.
  4. Add the below line line in the file and save and exit.
    PROMPT="macOS %% "

    You can add any text you want here, even an emoji 🧑🏻

    Now Press Control + X followed by Y and Enter.

  5. To apply changes type source ~/.zshrc on the prompt and enter
  6. You will see that the prompt has changed to macOS %
Change Prompt text in ZSHRC file Example
macOS Terminal Prompt has been changed

This is not an AI-generated article but is demonstrated by a human on an M1 Mac running macOS Sonoma 14.0.

Please support independent contributors like Code2care by donating a coffee.

Buy me a coffee!

Buy Code2care a Coffee!
-

Facing issues? Have Questions? Post them here! I am happy to answer!


Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap