Re: How To Run Terminal.app from Xcode
Re: How To Run Terminal.app from Xcode
- Subject: Re: How To Run Terminal.app from Xcode
- From: Bayes Scott F <email@hidden>
- Date: Thu, 03 Nov 2011 10:04:56 -0700
Hi Andreas,
Is it feasible to put the env variable into .bash_profile or somewhere like that, depending on whether you get a login shell?
I suspect the export in your script is executing in a sub-shell, and that environment disappears before you reach the following cd. The classic solution is either to put the env variable into a standard startup file for the shell as above, or to stick it into a separate specialized file, e.g. ~/.testenv, and replace your export line with the shell's "sourcing" command, "."
. ~/.testenv
There's also a third-party System Preferences panel (probably available on MacUpdate) called Environment Variables that seems to set up your login environment with the values you put into it. You can bypass it by editing ~/.MacOSX/environment.plist apparently. Requires logout/in, so is very sticky and global for your account.
ScottB
On Nov 3, 2011, at 08:51 , Andreas Grosam wrote:
> 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
_______________________________________________
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