$PATH is not updated
Solution 1
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.
Solution 2
Do this in the shell:
$ source ~/.bashrc
This makes the current session aware of the change.
Related videos on Youtube
Admin
Updated on September 18, 2022Comments
-
Admin over 1 year
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.
-
Admin over 10 yearsHave you quit terminal and retry?
-
Admin over 10 yearsyes, sure, I restarted it!
-
Admin over 10 yearsType ". .bash_profile" to reload .bash_profile and update any functions you add.
-
Admin over 10 yearsit didn't help, I don't understand why there are no paths from /etc/paths? only /usr/local/bin
-
naren over 10 yearsAny change if you put those lines in
.bashrc
instead? -
Admin over 10 yearsHm, I moved to
.bashrc
and make emptybash_profile
and it helped. But I believe I've made this already(: -
naren over 10 yearsFrom
man bash
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order,
-
Penghe Geng over 10 yearsYou sure there's no such line somewhere in your .bash_profile or .bashrc:
export PATH=/usr/local/bin
?
-
-
Admin over 10 yearsI still have no effect! I even have no /usr/bin in PATH.