How to import keychain from one development machine to another

code-signing, macos, xcode

Solution

That message is usually indicative that you don't have the private key necessary for signing, just the certificate, which is insufficient.

For exporting signing identities, your best bet is to use the Accounts preference panel in Xcode.

- Launch Xcode on the machine you are sending the signing information from

- Choose Xcode > Preferences

- Select the Accounts tab

- From the gear menu, choose Export Accounts and select the file you want to place the information in and enter a password

- Transport the exported identity file to the receiving machine

- Follow steps 1-3 on the Receiving machine

- From the gear menu, choose Import Accounts and select the file you have just brought over, entering the password when asked.

This should import the entire signing identity, including the certificates, provisioning profiles, and private keys.

Via Keychain Access

If, for some reason, your Xcode on the machine that you are sending the signing information from does not have any accounts listed, you may be signing with a script or from the command line and using the identity information without loading the accounts directly into Xcode's UI. If possible, I would encourage adding your account to Xcode using the Accounts tab in order to get the automatic behaviors that Xcode provides, but it may not be absolutely necessary, especially if you are doing Developer ID only (non AppStore) distribution.

To export from Keychain Access, you will need to export both the Signing Certificate and the Key. The Signing Certificate is also available from Apple's Developer portal, but the key never leaves your machine directly (only a fingerprint of it is sent in the CSR), so if the original key does not exist on a machine that your organization has access to, you may need to Revoke your existing key and create a new one.

To locate your key in Keychain Access do the following:

- Launch Keychain Access

- Click on My Certificates

- Look through the list or use the search box to find your certificate (Searching on `Developer ID` should yield any Developer ID-related certificates)

- Each certificate which has an associated private Key will have a disclosure triangle to the left, click on that to expose the keys

- This Key may be exported by selecting the key and certificate (make sure they're both selected, or export them one at a time) and using File > Export Items

- Provide a password when prompted to protect the export file

- Copy the exported file(s) to your other machine

- Use Keychain Access and File > Import Items to import the certificate/key to the new machine

NOTE: If you lose your private key, you will need to revoke your certificate, generate a new key, and create a new signing certificate. Don't do this without first making sure you have no available copies of the key. The specific implications depend on what kind of certificates are signed with the key, but you will need to regenerate all of the certificates that used the previous key.

Problem

Actually we are using two MAC machines to develop a Package in mac using xcode. Only one mac is having a certificate and that is in different country. we exported that certificate for local mac.but when i try to do codesigning using that certificate i am getting error as "Could not find appropriate signing identity for “Developer ID Installer: ID ” I am not able to add the codesign. what are the steps to import a certificate properly.

Original source