Generate an iOS signing certificate

Learn how to generate the .p12 file used for signing your iOS app. A signing certificate is a digital identity used for code signing during the build and archive process. For more information, see Apple’s What is app signing?.

Generate .certSigningRequest file

On your macOS device, launch Keychain Access.

On your macOS device, launch <strong>Keychain Access</strong>

From the Keychain Access menu, choose Certificate Assistant, then select Request a Certificate From a Certification Authority.

launch <strong>Keychain Access</strong>

Enter your email and name, but leave CA Email Address blank. Then choose Save to disk and select Continue.

Enter your email and name, but leave <strong>CA Email Address</strong> blank. Then choose <strong>Save to disk</strong> and select <strong>Continue</strong>

Select Save to download your .certSigningRequest file.

Select <strong>Save</strong> to download your <code>.certSigningRequest</code> file.

Generate .cert file

Open Apple Developer, select Certificate, Identifiers and Profiles, then Create new certificate.

Open Apple Developer, then select <strong>Certificate, Identifiers and Profiles</strong>, then <strong>Create new certificate</strong>

Choose Apple Development, then select Continue.

Choose <strong>Apple Development</strong>, then select <strong>Continue</strong>

Select Choose File, choose the .certSigningRequest file, then select Continue.

Select <strong>Choose File</strong>, choose the <code>.certSigningRequest</code> file, then select <strong>Continue</strong>

Select Download to download your .cert file.

Select <strong>Download</strong> to download your <code>.cert</code> file

Generate .p12 file

On your macOS device, launch Keychain Access.

Select Certificates, then drag and drop your .cert file into the Certificates page.

On your macOS device, launch <strong>Keychain Access</strong>

Right-click your .cert file, then select Export <your-cert-file>.

Right-click your <code>.cert</code> file, then select <strong>Export <your-cert-file></strong>

Choose the Personal Information Exchange (. p12) file format, then select Save.

Choose the <strong>Personal Information Exchange (.p12)</strong> file format, then select <strong>Save</strong>

Enter a password to protect the certificate. If you don’t want to enter a password, leave the field blank and select OK.

Enter a password to protect the certificate, or leave the fields blank and select <strong>OK</strong>

Add .p12 file to Xcode project

Note down the location of the .p12 file you created in the previous section.

Launch Terminal on your MacOS machine and enter the below command:

sudo security import <Path to the cert>/<Name of the cert>.p12 -k /Library/Keychains/System.keychain -A
Replace <Path to the cert>/<Name of the cert>.p12 with the actual path and name of your .p12 file.

Enter the admin password of the MacOS machine to continue.

Enter the password inputted when exporting the certificate in the pop-up. If there is no password, leave the field blank and click OK.

Enter the password to import the certificate

The certificate is now imported to the keychain. Next, follow this guide to add the provisioning profile associated with the certificate into Xcode.