0

Recently, I changed my terminal prompt name to get rid of everything except the dollar sign. I did this a while ago, and from what I remember, I used System Preferences to make the change rather than my terminal. I want to change my name back to the default settings now, but I'm not sure how to undo this through System Preferences.

Edit: echo $0 gave me an output of -zsh and cat ~/.zprofile | grep -i ps1 output nothing and just printed $ on a new line.

Image of my terminal window

17
  • 1
    This isn’t a system preference (AFIK) because it can differ depending on the shell you use. You didn’t specify your macOS nor shell, so, start with this: in Terminal, type echo $0. If it says “bash” or “zsh” post the output of cat ~/.bash_profile | grep -i ps1 or cat ~/.zprofile | grep -i ps1 respectively. Be sure to do this with an edit to the original question
    – Allan
    Jun 13 at 18:45
  • 1
    If nothing was output, see if it is set in .zshrc
    – Allan
    Jun 13 at 19:26
  • I don't seem to have a .zshrc -- running ls -a shows .zprofile, .zsh_history, .zsh_sessions, and .zshenv but nothing else related to .zsh Jun 13 at 19:30
  • That’s ok, many folks use zshrc and zprofile interchangeably. It’s odd that you’re getting a $ prompt since the % is used in Zsh. Can you post the contents of cat ~/.zprofile | pbcopy. It will go to your clipboard so just paste it to the question. Format it if you can (for easy reading; see “help” on right side of AD)
    – Allan
    Jun 13 at 19:56
  • Sure, here it is: eval "$(/opt/homebrew/bin/brew shellenv)" Jun 13 at 20:05

2 Answers 2

2

It turns out that for some reason I added a command (EXPORT PROMPT=" $") to run on terminal startup sometime in the past. I found it by clicking on "Terminal > Preferences > Shell". Deleting that command fixed the issue.

0
0

Here are some examples of what I use at different times, in my .zshrc file:

PS1=" %n @%m %1~ ⚡ "

which gives me (when in my ~/Documents directory):

bw @Redwood Documents ⚡

Or:

PS1=" me here now: %1~ ⚡ "

which shows as:

me here now: Documents ⚡

(I use a colored lightning bolt so it's easy to spot.)

Remember to exit your current shell and start a new one to see the change. If you don't find a .zshrc file in your home directory, create it as a text file.

2
  • Just tried this -- I created a .zshrc and pasted in your example, but it didn't change anything Jun 14 at 19:29
  • 1
    Interesting. Mine has survived moving from bash to zsh and several OS upgrades up to the latest. I assume you exited any current terminal session and started a new one, and that you put the file in your home directory. I wonder whether you have some other, perhaps older (bash , maybe?) dot-files still in play. ADDED: Oh, I see you found the problem in your Terminal settings. Good sleuthing! Jun 15 at 16:00

You must log in to answer this question.

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