I have the following situation:
I have Mac OS bundle with application which uses some 3rd party dynamic libraries and those libraries depend on some environment vari
You can add a key "LSEnvironment" to your app bundle's Info.plist. The value can be a dictionary with strings for keys and values and those key-value pairs will be added to the environment when your app is launched by Launch Services (e.g. from the Finder or Dock but not from the Terminal).
<key>LSEnvironment</key>
<dict>
<key>ENV_VAR</key>
<string>value</string>
</dict>
However, in my testing (on Snow Leopard), it was a bit flaky to test, at least when editing the Info.plist of an existing app. Basically, Launch Services caches this part of the app's Info.plist when it first encounters the app and won't necessarily recognize changes on disk. You can sometimes prompt it to reread the Info.plist by, for example, duplicating the app bundle or temporarily moving it to a different folder. Of course, the overkill solution would be to use lsregister
to flush and rebuild the cache:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed
This caching issue won't affect your end users, just you as you tweak the Info.plist. Also, it shouldn't affect you if you make the change in your source Info.plist and then build the app using Xcode.
I am not sure if the following works because I don't have such an app to try. The idea is to set the environment variable from the terminal, then call your application:
ENV_VAR=something open -a YourApplication