MacOS – OS X Mavericks bash_profile paths don’t work

bashmacospath

I need to create a new path in OS X Mavericks.

To do so, I edited .bash_profile:

export LC_ALL="en_US.UTF-8"
export PGHOST=localhost

export PATH=$PATH:/usr/local/heroku/bin
export PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin

But it doesn't work. When I type echo $PATH, the result is:

/usr/local/heroku/bin:/usr/local/rvm/gems/ruby-2.0.0-p0/bin:/usr/local/rvm/gems/ruby-2.0.0-p0@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p0/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/nicolas/.rvm/bin:/usr/local/rvm/bin

This is the content of my .bashrc file:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
PATH=$PATH:/usr/local/rvm/bin # Add RVM to PATH for scripting

I don't have (or find) a .profile file.

What am I doing wrong?

Best Answer

After editing the login file you need to either run the source command on the login file or create a new terminal session before the updated environment variables will be available.

For Example:

source .bash_profile

I prefer to use this method of adding to the path. That way, if the file is executed multiple times, $PATH doesn't add redundant paths.

##
# DELUXE-HOME-BIN-INSERT
# (do not remove this comment)
##
echo $PATH | grep -q -s "${HOME}/bin"
if [ $? -eq 1 ] ; then
    PATH=$PATH:/bin
    export PATH
fi