MacOS terminal is a necessary tool for developers, system administrators, and tech enthusiasts. However, its default appearance and functionality may not always suit user preference or workflow. Therefore, if one can customize the terminal it will not only make it more visually appealing but also enhance the productivity by meeting specific needs. Whether one wants to change the color of username, modify the prompt, or personalize the entire terminal window, this guide will explain things in detail.
1- Change the Username Color in Terminal
One of the most common customizations is changing the color of the username in the terminal prompt. This can be done by editing the .zshrc
file, which is the configuration file for the Z shell (zsh), the default shell in macOS.
- Open the Terminal and navigate to your home directory by typing
cd ~
. - Open the
.zshrc
file using a text editor likenano
orvim
:
nano ~/.zshrc
Now, you need to add the following lines to customise the prompt colors:
autoload -U colors && colors
PROMPT="%{$fg_bold[red]%}%n%{$reset_color%}@%{$fg_bold[blue]%}%m %{$fg_bold[green]%}%1~ %{$reset_color%}%# "
A little explanation of the above lines of code is as follows:
Components | Meaning |
%{$fg_bold[red]%}%n | The username in bold red |
%{$reset_color%}@ | Resets color and adds @ |
%{$fg_bold[blue]%}%m | The hostname in bold blue |
%{$fg_bold[green]%}%1~ | The current directory (only the first level) in bold green |
%{$reset_color%}%# | Resets color and adds # (root user) or $ (regular user) |
Save the file and apply the changes by running:
source ~/.zshrc

2- Customize the Terminal Window Appearance
If you want to go beyond the prompt and customize the entire Terminal window, macOS allows you to create and modify profiles. These profiles control the font, colors, cursor style, and more.
- Open the Terminal app and go to
Terminal > Settings > Profiles
. - Choose a predefined profile or create a new one by clicking the
+
button. - Customize the following settings:
- Text: Change the font, size, and color of the text.
- Background: Set a custom background color or image.
- Cursor: Modify the cursor style and color.
- ANSI Colors: Adjust the colors for different types of text (e.g., commands, errors).
- Save your profile and set it as the default for all new Terminal windows.
3- Add Date and Time to the Prompt
Including the date and time in your Terminal prompt can be incredibly useful for tracking when commands were executed.
1. Open the .zshrc
file as described earlier.
2. Add the following line to include the date and time:
PROMPT='%D %T %n@%m %1~ %# '
Here, %D
displays the date in yy-mm-dd
format, and %T
shows the time in 24-hour format. You can also use %t
for 12-hour format or %*
to include seconds
3. Save the file and reload the configuration with source .zshrc
4- Remove Last Login Details
By default, the Terminal displays the last login details every time you open a new window. If you find this unnecessary, you can disable it.
1. Run the following command in the Terminal:
touch ~/.hushlogin
This creates an empty .hushlogin
file, which suppresses the last login message.
5- Use Oh My Zsh for Advanced Customization
For those who want even more customization options, Oh My Zsh is a popular framework that simplifies zsh configuration.
1. Install Oh My Zsh by running:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2. Once installed, you can choose from hundreds of themes and plugins. For example, to apply the agnoster
theme, edit the .zshrc
file and set:
ZSH_THEME="agnoster"
3. Reload the configuration with source .zshrc
to see the changes
6- Other Customization Options for Prompt
- Add Visual Effects: Use formatting options like bold (
%B
), underline (%U
), and highlight (%S
) to make your prompt stand out8. - Create Aliases: Save time by creating shortcuts for frequently used commands. For example, add
alias ll='ls -la'
to your.zshrc
file. - Enable Syntax Highlighting: Install plugins like
zsh-syntax-highlighting
to make your commands easier to read.
Conclusion
Customizing your macOS terminal is a simple yet powerful way to improve your workflow and make your command-line experience more enjoyable. From changing the username color to creating custom profiles and using advanced tools like Oh My Zsh, the possibilities of changing colors and themes are endless. By following the steps outlined in this guide, you can transform terminal into a personalized and efficient tool that meets your unique needs.