What is the proper way to modify environment variables like PATH in OS X?
I\'ve looked on Google a little bit and found three different files to edit:
On Mountain Lion all the /etc/paths
and /etc/launchd.conf
editing doesn't make any effect!
Apple's Developer Forums say:
"Change the Info.plist of the .app itself to contain an "LSEnvironment" dictionary with the environment variables you want.
~/.MacOSX/environment.plist is no longer supported."
So I directly edited the application's Info.plist
(right click on "AppName.app" (in this case SourceTree) and then "Show package contents
").
And I added a new key/dict pair called:
LSEnvironment
PATH
/Users/flori/.rvm/gems/ruby-1.9.3-p362/bin:/Users/flori/.rvm/gems/ruby-1.9.3-p362@global/bin:/Users/flori/.rvm/rubies/ruby-1.9.3-p326/bin:/Users/flori/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
(see: LaunchServicesKeys Documentation at Apple)
Now the application (in my case Sourcetree) uses the given path and works with Git 1.9.3 :-)
PS: Of course you have to adjust the Path entry to your specific path needs.