Skip to main content

Code Signing

Manage signing certificates and provisioning profiles for app distribution
Automate the management of signing certificates and provisioning profiles required for app distribution.

Overview

Code signing is required for:
  • App Store distribution
  • Ad-hoc distribution
  • Development builds
  • Enterprise distribution
The CLI provides a streamlined signing fetch command that:
  1. Resolves your bundle ID
  2. Finds matching certificates
  3. Locates or creates provisioning profiles
  4. Downloads everything to your local machine

Quick Start

Fetch Signing Assets for App Store

For App Store distribution:
This will:
  • Find your App Store distribution certificates
  • Locate or create an App Store provisioning profile
  • Download certificates as .cer files
  • Download the provisioning profile as .mobileprovision

Fetch Signing Assets for Development

For development builds (requires device IDs):

Profile Types

iOS Profiles

  • IOS_APP_STORE: App Store distribution
  • IOS_APP_DEVELOPMENT: Development builds
  • IOS_APP_ADHOC: Ad-hoc distribution
  • IOS_APP_INHOUSE: Enterprise distribution

macOS Profiles

  • MAC_APP_STORE: Mac App Store distribution
  • MAC_APP_DEVELOPMENT: Mac development
  • MAC_APP_DIRECT: Mac direct distribution
  • MAC_CATALYST_APP_DEVELOPMENT: Mac Catalyst development
  • MAC_CATALYST_APP_STORE: Mac Catalyst App Store

tvOS Profiles

  • TVOS_APP_STORE: tvOS App Store
  • TVOS_APP_DEVELOPMENT: tvOS development
  • TVOS_APP_ADHOC: tvOS ad-hoc distribution
  • TVOS_APP_INHOUSE: tvOS enterprise distribution

Complete Signing Workflow

1

Register your bundle ID (if new)

First-time setup for a new app:
Verify it exists:
2

Register development devices (for development profiles)

For development and ad-hoc profiles, register test devices:
List all registered devices:
3

Create certificates (if needed)

Generate a Certificate Signing Request (CSR) on your Mac:
Upload the CSR to create a certificate:
List existing certificates:
4

Fetch signing assets

Download everything at once:
The output directory will contain:
5

Install certificates and profiles

Install the certificate (double-click or use CLI):
Install the provisioning profile:
Or double-click the .mobileprovision file to install via Xcode.

Automatic Profile Creation

If no matching profile exists, use --create-missing to automatically create one:
For development profiles with specific devices:

Certificate Management

List All Certificates

Filter by Type

Check Certificate Expiration

Revoke a Certificate

Revoking a certificate will invalidate all provisioning profiles that use it. Only revoke certificates that are compromised or no longer needed.

Provisioning Profile Management

List Profiles

Get Profile Details

Download a Specific Profile

Delete a Profile

CI/CD Integration

GitHub Actions Example

GitLab CI Example

Advanced Usage

Filter Certificates by Type

When fetching, you can filter which certificates to download:

Fetch for Multiple Bundle IDs

For apps with multiple targets:

Verify App Association

Ensure the bundle ID matches your app:
The CLI will validate that the bundle ID is associated with the specified app.

Troubleshooting

”No certificates found”

Problem: No distribution certificates exist for the account. Solution: Create a new certificate:
  1. Generate CSR in Keychain Access
  2. Create certificate:

“Bundle ID not found”

Problem: The bundle identifier doesn’t exist in App Store Connect. Solution: Register the bundle ID:

“Device IDs required for development profiles”

Problem: Development profiles require registered devices. Solution: Register devices and include their IDs:

“Failed to create profile”

Problem: Profile creation failed due to missing prerequisites. Solution: Verify requirements:
  • Bundle ID exists
  • Valid certificates exist
  • For development: devices are registered
  • Account has necessary permissions

Certificate Not Installing

Problem: Double-clicking the .cer file doesn’t import the certificate. Solution: Use the security command:
Verify installation:

Best Practices

  1. Automate certificate renewal: Set up alerts for expiring certificates (they expire after 1 year)
  2. Use different certificates for different environments: Separate development and distribution certificates
  3. Protect private keys: Never commit certificates or private keys to version control
  4. Use CI/CD secrets: Store API keys and certificates as encrypted secrets in your CI/CD platform
  5. Regenerate profiles after certificate renewal: When you renew certificates, regenerate all associated profiles
  6. Keep device lists updated: Regularly add new test devices and remove old ones
  7. Use --create-missing in CI: Ensures profiles are created if they don’t exist
  8. Clean up old profiles: Delete unused profiles to avoid confusion