我正在调试bash
程序,我对如何在Mac OS X中设置PATH
感到困惑。例如,我有一台相对较新的笔记本电脑Server.app
安装了1}}和homebrew
,但没有多少。当我删除~/.bashrc
和~/.bash_profile
个文件并执行echo $PATH
时,我得到:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin
我的PATH
如何被修改?
答案 0 :(得分:2)
您要找的是path_helper
来自man path_helper
The path_helper utility reads the contents of the files in the directo-
ries /etc/paths.d and /etc/manpaths.d and appends their contents to the
PATH and MANPATH environment variables respectively. (The MANPATH envi-
ronment variable will not be modified unless it is already set in the
environment.)
Files in these directories should contain one path element per line.
Prior to reading these directories, default PATH and MANPATH values are
obtained from the files /etc/paths and /etc/manpaths respectively.
如果你看它在/ etc / profile
中被调用[~] cat /etc/profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi