
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
- Open
Terminal.app - Navigate to your base user directory by entering
cd ~/. - Enter
touch .hushlogin. This creates an invisible file calledhughlogin.
Remove computer name from the prompt
- Navigate to your home directory. Enter
cd ~/and typesudo vim .bash_profile. - If
.bash_profiledoesn’t exist, you can typetouch .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.
- Now
vimis open. It’s a shell based text editing application. - Hit
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. - Type
: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.
