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?

up vote 9 down vote accepted

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.

Well, if you really wanted to OVERWRITE the path, you could just set the new one in /etc/launchd.conf. There is a similar question here.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.