Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to set the PATH environment variable in OSX in a particular order (i.e. with /usr/local/bin first in line).

The recommended way to set PATH variables seems to be the /etc/paths files and the /etc/paths.d directory which work but automatically rearrange the order of the specified paths.

I could override this in my .profile but I get the suspicion that programs such as Homebrew do not pick up on user defined environment variables

share|improve this question

3 Answers 3

Literally just come across this answer on Stackoverflow, it seems that /etc/profile might be the answer? - although this is shell specific ...

share|improve this answer

To make sure programs launched from the GUI see environment variables, you want to set them in ~/.MacOSX/environment.plist, which like all textual OSX plists is an XML file. I personally use this prefpane to manage it.

Note that the plist is only read when the session starts, so you will need to log out and back in or reboot after setting it.

share|improve this answer

Programs run from the terminal will pickup the $PATH variable in .profile.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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