Cleaning up the prompt

The default settings on macOS’s 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

  1. Open
  2. Navigate to your base user directory by entering cd ~/.
  3. Enter touch .hushlogin. This creates an invisible file called hughlogin.

Remove computer name from the prompt

  1. Navigate to your home directory. Enter cd ~/ and type sudo vim .bash_profile.
  2. If .bash_profile doesn’t exist, you can type touch .bash_profile to create the file.
  3. Enter your user password if requested. When you’re typing the password, you’ll be unable to see the characters.
  4. Now vim is open. It’s a shell based text editing application.
  5. Hit i to enter edit mode.
  6. Copy and paste export PS1="\W \$". This will change the prompt to show $. You can change this to whatever you’d like.
  7. Hit the Esc key to exit edit mode.
  8. Type :wq! to tell vim that you want to write the changes and quit.
  9. Quit and reopen You should now have $ as your prompt.
Show Comments