4

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$ "

1 Answer 1

9

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
7
  • 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, 2015 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. Jun 23, 2015 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 Jun 23, 2015 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)
    – mmmmmm
    Jun 23, 2015 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.
    – Saad
    Jun 23, 2015 at 13:28

You must log in to answer this question.

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