I found answers but they don't work: I added this line in .bash_profile:

export PS1='\u@\H:\w$'

It outputs:


Instead of:

  • what is the full path to .bash_profile file?
    – tron_jones
    Nov 13, 2014 at 17:19
  • /Users/<User>/.bash_profile
    – klanomath
    Nov 13, 2014 at 17:23
  • For the OP. Seeing if you didn't put the command somewhere else and not his ~/ folder.
    – tron_jones
    Nov 13, 2014 at 17:24
  • can you post your .bash_profile? I reproduced this only if I leave out the single ticks in the command.
    – tron_jones
    Nov 13, 2014 at 17:27

2 Answers 2


As I just removed oh my zsh I had to change terminal settings a little:

Terminal -> Preferences -> Startup tab, and change "Shell Opens With:" from "Default login shell" to Command and value /bin/bash.

Now string export PS1='\u@\H:\w$' works correct.

  • I put a space after w$ but before ' so the command prompt looks better when you type commands.
    – Sun
    Sep 29, 2017 at 21:32

With macOS Catalina, the default shell is zsh. You can either switch to the /bin/bash shell as explained in Maxim's answer. Or stay with the zsh shell and change the startup run command to say

PROMPT='%/ %# '

The %/ is for full path and %# is to indicate whether the shell is running with privileges. More explanation and the full list of customizations is here.

I found this info here.

You can add the startup run command mentioned above in the 'Run command: ' field at Terminal > Preferences > Profiles > Shell > Startup. This is what I did. You could instead add the command to the .zshrc file as well. Either way, quit and restart the terminal for the changes to take effect.

  • 1
    Given how old the original question is, the chances that the user was using Bash are quite high. Aug 7, 2020 at 1:51
  • Yes. I just added this here in case someone on Catalina comes here with the same question. Sorry if I posted in the wrong place.
    – abhigdeal
    Aug 10, 2020 at 6:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .