How To Run Terminal.app from Xcode
How To Run Terminal.app from Xcode
- Subject: How To Run Terminal.app from Xcode
- From: Andreas Grosam <email@hidden>
- Date: Thu, 03 Nov 2011 16:51:21 +0100
My unit test app runs as a console program. In order to run, it requires an environment variable set:
DYLD_FRAMEWORK_PATH=<path/to/library>
I have no issue setting up the arguments and environment variables in the Scheme editor, and launching the executable from Xcode works fine, or launching the executable from within Terminal.app (after setting the DYLD_FRAMEWORK_PATH).
Well, now to streamline my workflow I would like to run the unit test directly after the build phase in Terminal.app. My attempts to setup the a "Post-action" in the Build section in the Scheme editor so far failed. The Terminal.app will be launched which a new window starting the required executable, but the environment variable DYLD_FRAMEWORK_PATH is not set. So,I get a dynamic linker error at runtime:
dyld: Library not loaded: <path to library>
Reason: image not found
Trace/BPT trap: 5
logout
[Process completed]
The bash script looks as follows:
export DYLD_FRAMEWORK_PATH=/Users/path/to/library
cd ${BUILT_PRODUCTS_DIR}
open -a Terminal.app AllTests
This above also fails when launched from within Terminal. It seems, the environment variables will not be inherited.
The following script works from within a post action in Xcode when directly invoking the executable:
export DYLD_FRAMEWORK_PATH=/Users/path/to/library
cd ${BUILT_PRODUCTS_DIR}
./AllTests
The output goes to the Console.app, though.
So, how can I launch Terminal with proper environment variables set - or get this to work by other means?
Thanks in advance for tips!
Andreas _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden