Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install developer certificate/private key and provisioning profile for iOS development via command line?

I'm configuring automated build server for iOS application project. I've done most of it. Now, it's the final round. The security.

Developer certificate/private key and provisioning profile can be easily installed into Keychain with GUI. But I want to do this via command line to automate even the configuring process. Exporting/importing certificates, private keys, provisioning profiles via command line.

Any recommendations will be very appreciated.

like image 390
eonil Avatar asked Dec 06 '10 17:12

eonil


People also ask

How do I add development certificate to provisioning profile?

Login to https://developer.apple.com. Click Certificates, Identifiers and Profiles . Under Provisioning Profiles , Click All . Click Add(+) to register a new provisioning profile.


2 Answers

The always allow GUI is being triggered because codesign hasn't been given an acl to access your private key. try this:

security unlock-keychain -p <my keychain password> security import Certificate.p12 -k ~/Library/Keychains/login.keychain -P password -T /usr/bin/codesign 

The -T flag tells security to allow codesign to have access to the keys you are importing in Certificate.p12.

like image 184
ablarg Avatar answered Sep 20 '22 12:09

ablarg


I found hints from: http://lists.apple.com/archives/apple-cdsa/2010/Mar/msg00021.html

The command is security. I'm reading manual page. I'll update this answer later after trial :)

--(edit)--

First, we have to give 'Always Allow' access to the certificates/keys in the Keychain manually once. I don't know how to do this without GUI.

And run the command security unlock-keychain before running build tool for every session. I've used SSH, so I had to execute it once for every login sessions.

like image 38
eonil Avatar answered Sep 17 '22 12:09

eonil