Is there a way to remove the authorization prompt from command-line instances of Instruments (Xcode)?

前端 未结 11 943
南笙
南笙 2020-12-02 07:53

I am currently using Instruments via a bash script to initiate the command-line interface to start up runs of the Automation plug-in.

With 4.2, this worked well en

相关标签:
11条回答
  • 2020-12-02 08:27

    I tried security unlock-keychain and editing the /etc/authorization file, but neither of those worked.

    In the end the only thing that removed that security prompt was what jacekmigacz suggested in a comment, to run "sudo DevToolsSecurity --enable".

    0 讨论(0)
  • 2020-12-02 08:30

    I also faced with this issue on El Capitan. I found this article very helpful https://www.dssw.co.uk/reference/authorization-rights/. Based on it I changed following rights in order to overcome this issue:

    system.privilege.taskport
    system.privilege.taskport.debug
    system.privilege.taskport.safe
    com.apple.dt.instruments.process.analysis
    com.apple.dt.instruments.process.kill
    
    0 讨论(0)
  • 2020-12-02 08:35

    The user your script runs as has to be authorized to use the developer tools. You can do this two ways:

    • Add the user to the _developer group: sudo dscl . append /Groups/_developer GroupMembership scriptusername

    • Use the DevToolsSecurity command line tool

    Keep in mind that for the UIAutomation instruments to work properly, the user you are invoking Instruments from will also need to be a user that can start a window server (i.e. run the UI) - and will have to be logged in to a window server when UIAutomation runs.

    These two things are two of the four or five secrets to using UIAutomation with Jenkins.

    0 讨论(0)
  • 2020-12-02 08:37
    sudo security authorize -u [username]
    

    worked for me.

    0 讨论(0)
  • 2020-12-02 08:38

    Adding to Alexander's answer, I found that for Mavericks, because of the way authorizations are handled (source), you should do this:

    sudo security authorizationdb write system.privilege.taskport allow

    I am running zucchini functional tests through a Jenkins job in a VMWare VM, and the slave couldn't launch properly the simulator and would hang on the splash screen, probably because of incorrect authorisations. This helped me solve this issue, hope it helps others.

    0 讨论(0)
  • 2020-12-02 08:39

    Here's a wonderful command that may work for you:

    security unlock-keychain -p [password] "${HOME}/Library/Keychains/login.keychain"
    

    It's the command-line way to gain access to a keychain on the Mac. I haven't tested it with Automation, but it's how I've integrated my iOS builds with Jenkins.

    (Replace [password] with the password)

    0 讨论(0)
提交回复
热议问题