OS X路径中的/usr/bin之前的/usr/local/bin是否存在问题? [英] Is there a problem with having /usr/local/bin before /usr/bin on the path in OS X?

查看:73
本文介绍了OS X路径中的/usr/bin之前的/usr/local/bin是否存在问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,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 在/usr/bin中安装的 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之前是否有问题?苹果是否默认将/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).

虽然冗余,但对~/.bash_profile中的路径添加/usr/local/bin似乎更安全,这意味着/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/bin之前的/usr/local/bin是否存在问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆