How to set environment variables for Mac OS X applications

Although the typical Mac user, living in the Aqua land of blissful ignorance, usually does not care about environment variables and other such "strange" beasts, it may sometimes become unavoidable having to deal with this stuff from the ninth hell of command line wickedness.

My moment of truth came when I wanted to run the Gimp (the official Mac port can be downloaded from here) in a different language (English) than the default language of my Mac OS X installation (German). For this I had to run using the environment variable LANG set to the value en.

I guess the canonical source for information on how to set environment variables for Mac OS X applications (i.e. .app bundles) can be found in this article on

Probably the best/easiest way to edit the environment.plist file (mentioned in the above article) is the very nice (and free) "Environment Variables" preference pane that can be downloaded from This lets you change environment variables comfortably from within the System Preferences application. However, modifying environment.plist changes the environment for all applications. If you want to make the change apply to only one single application, you have two options, both of which need some manual fiddling:

  1. Single-shot:
    • Open a session in
    • Set the desired environment variable (e.g. "export LANG=en"); note that the variable needs to be exported in order to be inherited by the application
    • Launch the application (e.g. "open /Applications/")
    • Voilà, the application inherits the environment from the terminal session
    • You can repeatedly launch applications from the same window, but once you close this window, the environment variable is gone
  2. Persistent:
    • Note: You need to have administration privileges for this because you are going to edit a file from within the /Applications folder
    • Open the Info.plist file located within the application bundle (e.g. "open /Applications/")
    • Add a top-level key named LSEnvironment which is of type "Dictionary"
    • Add a child key to the dictionary which represents the desired environment variable; the key name/value corresponds to the environment variable's name/value (e.g. key name = "LANG", value = "en")
    • Save the changes back to the Info.plist file
    • From now on, whenever you launch the application in the Finder or from the Dock, the application will run with the correct environment variable set

Note that, for some unknown reason, approach #2 did not work when I tried setting the LANG variable for Since I am happy with approach #1, though, I did not investigate any further. I leave approach #2 written up as it is, because this is how it is supposed to work according to the official documentation at (see URL at the top of this post). YMMV.