Using xcodebuild, or better xcrun xcodebuild we can do things such as running tests from the terminal.

xcrun xcodebuild \
  -workspace "Coconut.workspace" \
  -scheme "Coconut" \
  -sdk iphonesimulator \
  -destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' \
  test

But what to write in the -destination parameter? How do we know the available devices that can be used as parameter?

The instruments cli tool from Apple has an answer to that.

instrumenstruns an Instrument template from the command line”, and one of the available options to pass is is -s devices, to “show list of known devices, and then exit”.

instruments -s devices

Known Devices:
Gio’s MacBook Pro [<uuid>]
Gio's iPhone 6 (8.2) [<uuid>]
Resizable iPad (8.2 Simulator) [<uuid>]
Resizable iPhone (8.2 Simulator) [<uuid>]
iPad 2 (8.2 Simulator) [<uuid>]
iPad Air (8.2 Simulator) [<uuid>]
iPad Retina (8.2 Simulator) [<uuid>]
iPhone 4s (8.2 Simulator) [<uuid>]
iPhone 5 (8.2 Simulator) [<uuid>]
iPhone 5s (8.2 Simulator) [<uuid>]
iPhone 6 (8.2 Simulator) [<uuid>]
iPhone 6 Plus (8.2 Simulator) [<uuid>]

There you go, here’s the list of known devices to the computer, and any of can be used as the parameters for the -destination argument.

Food for though

  • What other cool things can we do with instruments?
  • How to use pick to select the destination parameter interactively