Set PATH variable so that it is detected in all applications, even outside terminal. (El Captain)
Solution 1:
The loginwindow
process sets a user's environment. It sets the variables TMPDIR and PATH, consults Directory Services and sets SHELL HOME USER LOGNAME . PATH is set to /usr/bin:/bin:/usr/sbin:/sbin
unless modified by launchd (in the more current versions of OS X). This is the PATH variable available to the user's processes unless modified by that particular process (cron
as an example sets the PATH to /bin:/usr/bin
).
Terminal emulator applications start your shell as a login shell thus the PATH is modified by reading the various shell startup file. Any process started by your shell now inherits the new PATH variable. Other applications using a shell do not read any shell config files and use those environment variables available in the current environment. An application may modify the environment by using the LSEnvironment
key in their Info.plist
.
As of Yosemite, you can change the PATH variable in the following form.
sudo launchctl config user path <path>
in your case you want /usr/local/bin at the front of the path.
sudo launchctl config user path /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
reboot
your system and the new PATH will be set by loginwindow
.