Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Sample code for how to run UI Automation from the command line.
Shell Objective-C JavaScript
branch: master

Merge pull request #6 from johngibb/master

specify field separator to allow arguments with spaces
latest commit 4be0a2e64d
@jonathanpenn authored



This is a demo app to showcase how to run UI Automation scripts from the command line.


You need to have at least Xcode 4.5 along with the command line tools.

Running The Demo

Just open a terminal window, change to the project directory and run this:


It will build the application with xcodebuild in the /tmp directory and then execute it with my unix_instruments wrapper that ensures that Instruments returns a proper exist status code when a test fails. You can read more about how that works in the copious comments.

Running on iPad Simulator

For some reason, Instruments will always launch a universal app in the iPad simulator when launched from the command line. This happens even if you change the simulator device type explicitly in the menu. To get this to work, you need to rebuild the app and tell Xcode to explicitly choose one of the device family types like so:

xcodebuild -sdk iphonesimulator clean build \

Setting TARGETED_DEVICE_FAMILY to 1 changes the Info.plist file so that build is only for iPhone. Setting it to 2 makes it only for iPad.

Something went wrong with that request. Please try again.