views:

32

answers:

1

Xcode sets variety of environment variables related build when running shell script. Is there a way to running shell script without setting of those variables?

A: 

I got a solution. Use this method in Run Script Phase target phase: http://serverfault.com/questions/176966/how-to-continue-execution-of-shell-script-after-calling-other-shell-script-with/176976#176976

These shell commands run following command ignoring variables in current environment.

env -i <command>
exec -c <command>

As an example, I used this script:

env -i ./makeall.sh

This disables all of Xcode's predefined variables, so script does not affected by Xcode configuration, but it's also less useful because we cannot use Xcode paths related build.

So, however, you can pass specific Xcode variable like this script.

build()
{
    # Don't know why, however, the environment variable passed to external script even with "env -i".
    env -i ./makeall.sh "${SYMROOT}"
}

build
Eonil