Select Page

I’ve recently done a clean install of macOS High Sierra and after re-installing my iOS development and distribution certificates (see below for how to do this) I had problems with Xcode constantly asking for admin rights. This was particularly apparent when deploying to a physical device where Xcode seemed to get stuck in a loop of requesting admin rights:

After a bit of digging around I found out that the issue was related me having accidentally put my certificates in the System keychain, rather than my login keychain, where they should be:

The problem was easily solved by simply dragging the certificates from the System keychain to the login keychain:

 

Reinstalling Xcode on a New Machine

When you install Xcode on a new machine you need to be aware that the private key used when signing apps is NOT available for download from the Apple Developer portal. Nor can Xcode download it. Only the public key part is available, which is not enough for signing.

If you’ve not made a copy of your iOS developer and distribution certificates you will have to revoke and recreate your developer and distribution certificates. However, re-creating your development or distribution certificates does NOT affect apps you’ve submitted to the store, nor does it affect your ability to update them. See the Apple’s documentation on the subject for more details.

Make a Copy of your Certificates

Open the Keychain Access app.

Select login > Certificates.

You should now see two iPhone-related certificates:

If you expand either the Developer or Distribution certificate you’ll see the private key, which is necessary for signing:

Select both the developer and distribution certificates, right-click and select Export 2 items…:

Give the certificate container a name and then Save it:

You can now back this up for later use or transfer it to another machine to setup your Apple ID developer account.

 

Restoring Previously Saved Certificates

First, make sure Xcode is not running. If you had previously tried to setup your Apple ID developer account in Xcode then remove it (Xcode Preferences > Accounts).

Check Keychain Access – if either the developer and distribution certificates are present (likely only the public keys will be there), remove them.

In Keychain Access select File > Import Items…:

Select the .p12 file used to previously save your certificates.

You can now open Xcode, re-add your Apple ID account and download all associated provisioning profiles.