I found answers but they don't work:
I added this line in .bash_profile
:
export PS1='\u@\H:\w$'
It outputs:
\u@\H:\w$
Instead of:
user@host:my/Current/Path/In/This/Terminal/Window$
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this communityI found answers but they don't work:
I added this line in .bash_profile
:
export PS1='\u@\H:\w$'
It outputs:
\u@\H:\w$
Instead of:
user@host:my/Current/Path/In/This/Terminal/Window$
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.
w$
but before '
so the command prompt looks better when you type commands.
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.