Run automation instruments script from the command line

To run ui test from command line you can use instruments app as described here.

  instruments -w deviceID -t defaultTemplateFilePath targetAppName \
  -e UIASCRIPT scriptFilePath -e UIARESULTSPATH resultsFolderPath

The problem is defaultTemplateFilePath depends on xcode version. Documentation says Automation.tracetemplate is located here :

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate

Since xcode 6 Automation.tracetemplate can be found:

/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate