问题描述
默认情况下,OS X 10.6 使用 /usr/libexec/path_helper
添加文件 /etc/paths
中列出的以下路径:
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
这意味着 /usr/bin
在路径上出现在 /usr/local/bin
之前.这会导致 /usr/bin
中 Xcode 4 安装的 git 版本被调用而不是 Homebrew 安装到 /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
.
这引出了我的问题,在路径中将 /usr/local/bin
放在 /usr/bin
之前是否有问题?Apple 默认将 /usr/bin
放在 /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
?
将/usr/local/bin
从文件/etc/paths
的底部移动到顶部是否有问题?这样做不仅会在我启动终端时影响路径,因为 /usr/libexec/path_helper
可能会被其他资源使用(我不确定这一点).
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).
虽然多余,但对我来说将 /usr/local/bin
添加到 ~/.bash_profile
中的路径似乎更安全,这意味着 /usr/local/bin
将在路径上两次.
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.
推荐答案
没有,也没有.他们只是很奇怪......根据定义本地应该覆盖.
No, and no. They're just weird ... local by definition should override.
这篇关于在 OS X 中的路径上的/usr/local/bin 之前有/usr/local/bin 有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!