Reputation: 2317
I'm debugging a bash
program, and I'm a bit confused about how the PATH
is set in Mac OS X. For example, I have a relatively fresh laptop which has Server.app
and homebrew
installed but not much else. When I delete my ~/.bashrc
and ~/.bash_profile
files, and do echo $PATH
, I get:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin
How is my PATH
being modified?
Upvotes: 1
Views: 430
Reputation: 20232
what you are looking for is path_helper
from 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.
if you look it is being called in /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
Upvotes: 2