1

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

Brendan
  • 153
  • 8

3 Answers3

1

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

Brendan
  • 153
  • 8
1

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.

geekosaur
  • 7,175
  • 1
  • 20
  • 19
0

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

JeffG
  • 1,194
  • 6
  • 18