2

Right now, this is what my Terminal shows:

MyName's-MacBookPro:location MyName$

I'd like for it to only show my name, so something like this:

MyName$

When I browsed online for a solution, they said to edit my .bashrc file. I added the following line to my .bashrc:

export PS1="\u$ "

but there hasn't been any change, even after restarting Terminal.

This is the current contents of my .bashrc file:

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PS1="\u$ "
8

Two easy options:

  • Move your changes from .bashrc to .bash_profile (and delete .bashrc)
  • Add a line source ~/.bashrc to ~/.bash_profile to make sure .bashrc is read during shell startup
  • 1
    While this will work, I'd suggest putting source ~/.bashrc into .bash_profile and then using .bashrc as normal. Don't know why the Bash shipped with OSX doesn't read .bashrc itself. – David Lord Jun 23 '15 at 8:48
  • Apple will undoubtedly replace bash in the next few years anyway since they will never use the latest GPLv3 version of bash (they don't use anything licensed under GPLv3). There hasn't been much innovation or improvement in OS X's bash in a very long time. – William T Froggard Jun 23 '15 at 8:59
  • Zsh is completely up to date on OS X though, and has some interesting features. I'd personally recommend that anyone bored with their shell should look into it. Plus: ohmyz.sh – William T Froggard Jun 23 '15 at 9:05
  • @DavidLord because the terminal running a shell is the first time OS X runs a shell and so should be a login shell (Under X11 the login shell runs and starts X11 and so the terminal are run as subshells of the login shell - I wonder if systemd use will chnage this) – Mark Jun 23 '15 at 12:36
  • Thanks a lot, that worked! @DavidLord, what exactly do you mean by "putting source ~/.bashrc into .bash_profile"? This sounds like a better way to do it. – saadq Jun 23 '15 at 13:28

You must log in to answer this question.

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