$PATH is not updated
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/binin ~/.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 $PATHin terminal, I get only
/usr/local/binif I put .bash_profile strings to .profile or .bashrc I have no effect.
85 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.
- Comment out every line in .bash_profile and save (or you could delete/rename it).
- Close out your terminal and restart it to reconstruct your PATH.
- 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 ~/.bashrcThis 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.
1Try 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).
- Got to /Users/username/
- Now press cmd + shift + . (Now all hidden files will be visible)
- Try to open the .bash_profile file and see your PATH item exists or not
- Comment items and echo $PATH and verify the edits are getting reflected.
- If not may be you are using zsh, so try editing the .zprofile