1

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
  • Have you quit terminal and retry?
    – study
    Sep 15 '13 at 18:40
  • yes, sure, I restarted it!
    – matr0sk1n
    Sep 15 '13 at 18:41
  • Type ". .bash_profile" to reload .bash_profile and update any functions you add.
    – dciso
    Sep 15 '13 at 18:47
  • it didn't help, I don't understand why there are no paths from /etc/paths? only /usr/local/bin
    – matr0sk1n
    Sep 15 '13 at 18:52
  • 1
    Any change if you put those lines in .bashrc instead? Sep 15 '13 at 18:57
3

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.

2

Do this in the shell:

$ source ~/.bashrc

This makes the current session aware of the change.

0

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
  • I still have no effect! I even have no /usr/bin in PATH.
    – matr0sk1n
    Sep 15 '13 at 18:46
0

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"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.