On May 8, 2012, at 3:46 PM, Lars C. Hassing wrote: In the second Terminal window I want to open a new instance of Xcode inheriting this window's environment variables for Program2: lch% open -n $BIN/Program2.xcodeproj
Oh, and I also meant to say: This isn’t going to do what you expect. Apps don’t inherit the environment of a shell that spawns them, because the app process isn’t a child of the shell. Apps are all children of the per-user ‘launchd’ process.
I don’t know if there’s a way to manipulate the environment of a launched app, but if there is, it would appear somewhere in the Launch Services API.
If for development purposes you want to mess with the environment, you can launch your own app by directly invoking its binary, something like $ build/Debug/MyApp.app/Contents/MacOS/MyApp In this special case it *is* a child of the shell process and inherits its environment. But apps should never be launched that way normally.
—Jens |