By default, OS X 10.6 uses /usr/libexec/path_helper
to add the following paths listed in the file /etc/paths
:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
This means that /usr/bin
comes before /usr/local/bin
on the path. This results in the version of git installed by Xcode 4 in /usr/bin
to be called instead of the version installed by Homebrew into /usr/local/bin
.
Which leads me to my question, is there a problem with having /usr/local/bin
come before /usr/bin
in the path? Is there a specific reason that Apple defaults to having /usr/bin
come before /usr/local/bin
?
How to change order of /usr/bin
and /usr/local/bin
Is it a problem to move /usr/local/bin
from the bottom of the file /etc/paths
to the top? Doing so would impact the path for more than just when I fire up Terminal, since /usr/libexec/path_helper
could be used by other resources (I'm uncertain about this).
While redundant, it seems safer for me to add /usr/local/bin
to the path in ~/.bash_profile
, which would mean that /usr/local/bin
would be on the path twice.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…