snowcrash09
snowcrash09

Reputation: 4804

Per-application environment variables on Mac OS X

There are several different ways documented of setting environment variables either system wide or per user, see this question.

Are there any options for setting environment variables on a per-application basis?

E.g. Is there a way to use something like ~/.MacOSX/environment.plist or launchd.conf but have some variables only inherited by specific apps?

The only way I can think of is to modify each applications Info.plist, but this involves changing an applications bundle which doesn't seem like a terribly good idea.

Upvotes: 1

Views: 1194

Answers (1)

Rob Napier
Rob Napier

Reputation: 299485

Typically this is done by wrapping the desired app in a small shell script or automator action that sets the environment variable and then launches the app. For example, I have an automator "application" that has the following rule:

Run Shell Script:
  NSZombiesEnabled=YES open /Applications/MyApp.app

When I want to launch it this way, I just run the automator action.

Upvotes: 4

Related Questions