Search code examples
iosui-automationios-ui-automationxcode-instruments

instruments + UIAutomation from shell script


Possible Duplicate:
Is there a way to remove the authorization prompt from command-line instances of Instruments (XCode)?

I've been stuck building a jenkins job to automatically run my UIAutomation script now ALL day. One by one I've worked through all the issues with doing this (jenkins running as a daemon by default, lots more) and I have one left. The 'instruments' command will ask for permission to listen to a process or something (I forget the exact wording) and since this requires a prompt of the user/pass it kills my script with error:

Failed to authorize rights (0x2) with status: -60007

This is my last hurdle to getting this working and I've tried:

echo "user\npassword" | instruments ....

but this doesn't seem to feed these prompted values in at all. Still fails with the same error. How do I run instruments or modify some file somewhere so it won't prompt for this?

Thankyou!


Solution

  • Sounds like something I am going to have to dive into soon myself.

    I'd be curious what happens if you add your instruments command to /etc/sudoers and then try to run. Might avoid the auth prompt you're seeing.

    To give it a try:

    1. "sudo visudo" in a terminal

    2. Add this line (replacing "yourargs" with the rest of your instruments command)

    yourUserName ALL=NOPASSWD: /usr/bin/instruments yourargs

    Then try running the command the Jenkins agent is trying to run, prefixing it with "sudo", e.g. "sudo instruments ..."