How to share an iOS distribution certificate

⋅ 3 min read ⋅ Development

Table of Contents

One of the most challenging tasks as an iOS developer is managing certificates. Fastlane helps us a great deal throughout these years, and with the coming of Xcode Cloud[1], which promises a cloud signing feature, managing certificates might be a thing in the past. But I think there would be an unpleasant time where you have to manage this yourself. When the time comes, I want you to be prepared.

The process usually consists of two parties.

  1. The one with all the access permission who create and export certificate and share with others.
  2. The one with fewer access imports the certificate to be able to distribute an app.

The hard part is on the former. They have to create and export. The one who wants to distribute an app needs to ask for the p12 file and import it to their machine.

Creating a Certificate

This process is quite straightforward

  1. Go to the Apple developer website and click Certificates, IDs & Profiles.
  2. Click plus icon to add a new certificate.
  3. Select "Apple Distribution" and click continue.
  4. Upload Certificate Signing Request. You can follow Apple instruction here or read it here.
  5. At the end, you will get distribution.cer file.
  6. Double click the cer file to install it in Keychain Access. The keychain app should open up automatically, and you will see your certificate under My Certificates tap. You can identify your certificate by name. It will show in this format TYPE_OF_CERTIFICATE FIRSTNAME LASTNAME (TEAM_ID). If you expand it, you will find a key with the same name that you just created in Create a certificate signing request.

At this point, you have a working distribution certificate for use on your machine. To share this certificate with other machines, you must export it.

Create a certificate signing request

  1. Launch Keychain Access located in /Applications/Utilities.
  2. Choose Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.
  3. In the Certificate Assistant dialog, enter an email address in the User Email Address field.
  4. In the Common Name field, enter a name for the key (for example, Sarunw Dist Key).
  5. Leave the CA Email Address field empty.
  6. Choose Saved to disk, and click Continue.

Exporting a certificate

  1. Open Keychain Access.
  2. Select My Certificates tab.
  3. Select the certificate you want to export. Should be in this format TYPE_OF_CERTIFICATE FIRSTNAME LASTNAME (TEAM_ID), e.g., Apple Distribution: Sarun Wongpatcharapakorn (XYZ).
  4. Right-click and select Export.
  5. Select a location to save p12 file.
  6. You can optionally protect the file with a password. This will be used when you import the certificate on the other machine. You can leave it blank if you want.
  7. Enter the computer password, then click Allow.

You will get a p12 file as a result from all these steps.

You can easily support sarunw.com by checking out this sponsor.

Import a certificate

The last step is to import the p12 file on a machine that you want to distribute the app.

  1. Double click on the p12 file (this should cause Keychain Access to open).
  2. You will see a dialog asking for the password (regardless of whether you set it or not). If you don't have a password set when you export it, just leave it blank and press OK.
  3. You should now have a new certificate in the login keychain.

  1. Xcode Cloud is a continuous integration and delivery service built into Xcode. It was first introduced in WWDC 2021. ↩︎


Read more article about Development or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.

Become a patron Buy me a coffee Tweet Share
Previous
A better way to ask for a one-time user's location with the Location Button

Asking for sensitive data like location is hard. Learn how Apple makes it easier with the new Location Button.

Next
New Formatters in iOS 15: Why do we need another formatter

We have a new way to format data into a localized string in iOS 15. Why do we need another formatter? How does it differ from the old one? Let's find out.

← Home