«

»

Remove Computer Name In maxOS Terminal

In a previous blog post Set maxOS Catalina Default Shell to Bash i described how to change shell on my MacBook from the new default macOS shell zsh back to bash. However, some time ago i decided to switch to zsh and when i did i wanted to do some housekeeping. First thing, which is covered in this blog post, is how to get a cleaner shell prompt.

As you can see the default prompt includes username@computer name:

I wanted to take out the computer name and just display my username. This is controlled in the file macOS file /etc/zshrc

Open the file and change the line under Default prompt comment to:

PS1=”%n %1~ %# ”

The default value which is commented out in the below screenshot is:

PS1=”%n@%m %1~ %# ”

After changing the configuration the command prompt, via the iTerm application, looks like this which is a bit better in my opinion.

1 pings

Comments have been disabled.