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

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 ...


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.


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .