echo $ PATH显示:
/usr/local/bin:/opt/local/bin:/opt/local/sbin://anaconda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/stefankaros/bin/FDK/Tools/osx
我的〜/ .bash_profile是:
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# added by Anaconda 2.0.1 installer
export PATH="//anaconda/bin:$PATH"
# Initialization for FDK command line tools.Tue Oct 7 20:01:15 2014
FDK_EXE="/Users/stefankaros/bin/FDK/Tools/osx"
PATH=${PATH}:"/Users/stefankaros/bin/FDK/Tools/osx"
export PATH
export FDK_EXE
# MacPorts Installer addition on 2014-10-22_at_21:44:05: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=/usr/local/bin:$PATH
我的主目录中没有.bashrc或以.bash开头的任何其他文件。 在我的PATH中,opt / x11 / bin来自哪里?为什么使用/ bin重复? 在我的.bash_profile中,导出FDK_exe有什么作用? PATH刚刚出现在该行之前?
答案 0 :(得分:1)
在Mac OS X上,有一个文件/etc/paths
,其中包含(在我的Yosemite机器上):
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
这些是您未在.bash_profile
中明确设置的PATH上的元素。还有一个目录/etc/paths.d
但在我的机器上是空的。另请参阅man path_helper
和/usr/libexec/path_helper
,来自/etc/profile
。
您可以清理PATH以删除重复的元素。请参阅How to keep from duplicating PATH variable in csh
- 即使您使用Bourne shell派生词也有相关答案。