Where is the system wide PATH shell variable set in OS X?
I'd like to set the PATH
shell variable for all users, but could not find where it is defined.
Having no export PATH
in my .bash_profile
, I have this:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
Where is this the PATH
shell variable defined?
On a shell level, the PATH
variable is set in /etc/profile by calling /usr/libexec/path_helper
. To add your own paths, you can add files with a path in it to /etc/paths.d/
:
pse@Fourecks:~$ ll /etc/paths.d
total 8
-rw-r--r-- 1 root wheel 13 Jul 22 07:02 50-X11
-rw-r--r-- 1 root wheel 12 Aug 13 14:12 TeX
pse@Fourecks:~$ cat /etc/paths.d/TeX
/Library/TeX/texbin
That's the safer way than editing /etc/profile
, /etc/paths
or any other system-provided file which may get overwritten with the next OSX upgrade.