I want to build a Xcode project from Terminal and then run it as required, also from Terminal.
I have been looking for a way to do this for a while now but only managed to find a method which works for the iPhone Simulator, not for the actual device it self.
Is this even possible? The reason I want to a Xcode project on a device from Terminal is because the application runs a series of automated tests and I would prefer to automate this process using a bash script.
Thanks
go to the 'Info' tab and in a menu 'Executable' choose 'Other...' in file window go to search input field and type 'terminal' and click on its icon when you find it. Now you should see 'Terminal. app' in 'Executable' field.
Build, Run, and Debug Your App To build and run your code, choose Product > Run, or click the Run button in your project's toolbar. Xcode analyzes your scheme's targets and builds them in the proper sequence. After a successful build, Xcode launches the associated app.
xcodebuild is a command-line tool that allows you to perform build, query, analyze, test, and archive operations on your Xcode projects and workspaces from the command line. It operates on one or more targets contained in your project, or a scheme contained in your project or workspace.
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=1 export WRITE_JUNIT_XML=1 clean echo "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 1 fi echo "${RESULT}\n"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With