M BUZZ CRAZE NEWS
// news

$PATH is not updated

By Daniel Rodriguez

It seems all about this was already discussed, but I can't resolve my problem. I have all necessary strings in /etc/paths

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

in ~/.bash_profile

export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:$HOME/.rvm/bin
export PATH="$(brew --prefix php54)/bin:$PATH"
export PATH="$(brew --prefix)/bin:$PATH"

But every time I execute

echo $PATH

in terminal, I get only

/usr/local/bin

if I put .bash_profile strings to .profile or .bashrc I have no effect.

8

5 Answers

PATH is constructed first from /etc/paths, then from the files in /etc/paths.d, and then from .bash_profile. Starting from the last step, methodically remove each step, and test to see if your problem is recreated.

  1. Comment out every line in .bash_profile and save (or you could delete/rename it).
  2. Close out your terminal and restart it to reconstruct your PATH.
  3. echo $PATH. It should contain everything from /etc/paths.

If everything from /etc/paths is included, then your problem lies in your .bash_profile. Uncomment one line at a time until you recreate your problem. Then you will know which line is your problem, and will be able to troubleshoot that instead of a vague PATH issue.

Alternatively, if deleting .bash_profile has no effect, then you have a problem that's occurring before .bash_profile acts. Check the files in /etc/paths.d - those also get appended to your PATH. Move them out of paths.d and then test whether your PATH is properly constructed from /etc/paths.

It seems like a lot of people have some trouble with rvm, as in this post and this post , so I'm guessing the problem lies in your .bash_profile. Good luck and let us know.

Do this in the shell:

$ source ~/.bashrc

This makes the current session aware of the change.

There could be spaces in the value of PATH and might be causing problems with it. Try placing it inside quotes:

export PATH="$PATH:/usr/local/mysql/bin"
export PATH="$PATH:$HOME/.rvm/bin"
export PATH="$(brew --prefix php54)/bin:$PATH"
export PATH="$(brew --prefix)/bin:$PATH"

Even though it's kind of unlikely with export. Perhaps the script is parsed in a different way.

1

Try putting the $PATH variable at the end of the line. In my .bash_profile that is how I have it and it works fine.

export PATH="/usr/local/mysql/bin:$PATH"

Alternate approach to trouble shoot, (It just worked for me and this is for osx users).

  1. Got to /Users/username/
  2. Now press cmd + shift + . (Now all hidden files will be visible)
  3. Try to open the .bash_profile file and see your PATH item exists or not
  4. Comment items and echo $PATH and verify the edits are getting reflected.
  5. If not may be you are using zsh, so try editing the .zprofile

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy