Build/run iOS Xcode project from Terminal Build/run iOS Xcode project from Terminal xcode xcode

Build/run iOS Xcode project from Terminal


To build your xcode project from the command line using a bash script use:

/usr/bin/xcodebuild -target TargetYouWantToBuild -configuration Debug

Look at the man page for xcodebuild for more options.

We do this for our unit test suite target, and we use GHUnit.

This is the section of our build script for running the tests:

export GHUNIT_CLI=1export WRITE_JUNIT_XML=1cleanecho "Building Bamboo GHUnit Tests..."OUTPUT=`/usr/bin/xcodebuild -target BambooAutomatedUnitTest -configuration Debug -sdk iphonesimulator4.3 build`RESULT=`echo "$OUTPUT" | grep "\\*\\* BUILD "`if [ "$RESULT" != "** BUILD SUCCEEDED **" ]then    echo "$OUTPUT"    exit 1fiecho "${RESULT}\n"