The default settings on macOS’s
Terminal.app show the last login and the name of the computer at the prompt line. With some simple adjustments, we can have a cleaner looking Terminal prompt.
Remove the last login message
- Navigate to your base user directory by entering
touch .hushlogin. This creates an invisible file called
Remove computer name from the prompt
- Navigate to your home directory. Enter
cd ~/and type
sudo vim .bash_profile.
.bash_profiledoesn’t exist, you can type
touch .bash_profileto create the file.
- Enter your user password if requested. When you’re typing the password, you’ll be unable to see the characters.
vimis open. It’s a shell based text editing application.
ito enter edit mode.
- Copy and paste
export PS1="\W \$". This will change the prompt to show
$. You can change this to whatever you’d like.
- Hit the
Esckey to exit edit mode.
:wq!to tell vim that you want to write the changes and quit.
- Quit and reopen Terminal.app. You should now have
$as your prompt.