This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Are you OK with a solution that sets the bash path or do you really need to change launchd's value of the base path for all processes?
–
bmike♦Sep 11 '12 at 15:29

I need to change the PATH used by GUI apps, for terminal/bash/... I already have a big set of working solutions.
–
sorinSep 11 '12 at 15:32

I don't know why eclipse and others don't just support runtime environment variables so every java developer on Mac doesn't need to worry about setting the path or sourcing in their desired variables in each project.
–
bmike♦Oct 1 '12 at 18:34

4 Answers
4

With Mountain Lion /etc/launchd.conf is where you should set the GUI applications Path. Remember it's not a script file; it only supports launchctl commands so you should write something like:

setenv PATH /new/path:/usr/bin:/bin:/usr/sbin:/sbin

Note also that it doesn't support shell environment variable substitutions (like $PATH) so you'll have to set every path that you want to include. It's a good idea to keep the original paths that you've mentioned (/usr/bin:/bin:/usr/sbin:/sbin).

You'll have to reboot after changing (or creating) the file for the changes to take effect.

I cooked up another solution, inspired by patrix one here, that hopefully is a little less painful. Open Automator, select an application as target, and choose Execute Shell script (or whatever it is called, in German it is "Shell-Skript ausführen" as can be seen above) as action. In the script, just type

Then save the whole thing wherever you want, and if you need to run YourApplicationHere, open the created "automator application" instead.

I tested this with Terminal as YourApplicationHere, and saw with launchctl export that FOO was indeed set to bar. I hope it works for others as well.

Finally, if you use this solution for your environment variables, instead of typing the launchctl stuff in the shell script, you may just call /Users/Shared/conflaunchd.sh (which you have to make up first, together with the file describing the variables).

We allow answers that make a good faith effort to address the question. We even allow wrong answers and let the voting speak for correctness. Commenting without making it personal is the best way to poke a hole in a faulty argument rather than discouraging attempts to answer.
–
bmike♦Oct 1 '12 at 18:22