Keys & cryptography

Keychain (macOS)

macOS's built-in encrypted store for passwords, certificates, and private keys. Xcode and codesign read signing identities from it.

macOS keychainKeychain AccessLogin keychainSystem keychain

The keychain is macOS's encrypted store for secrets. Every Apple Developer certificate you import on a Mac lands in a keychain, paired with the private key that signs builds for it. Xcode and the codesign command both look up signing identities in keychains, so a misconfigured keychain is the most common cause of mystery signing failures on CI.

Keychains you will see

Login keychain
Unlocked automatically when a user logs in. Most developer Macs store signing identities here.
System keychain
Available to every user on the machine. Often used on CI runners so the signing process does not depend on a particular user being logged in.
Custom keychain
A keychain file you create explicitly (security create-keychain). CI scripts often build a throwaway keychain per job and delete it at the end.

Why CI builds fail with 'no signing certificate' errors

  • The certificate was imported into a keychain that is not in the user's keychain search list.
  • The keychain is locked, so codesign cannot read the private key. security unlock-keychain is the fix.
  • The 'codesign' partition list on the imported key forbids non-interactive access, which surfaces as codesign wants to access key in your keychain. Run security set-key-partition-list to grant it.
  • A different keychain on the runner has an expired certificate of the same type and codesign picks that one first.

FAQ

Common questions about Keychain (macOS)

Why does codesign hang or prompt for keychain access in CI?

The private key's access control requires interactive approval, and there is no human to click Always Allow. After importing the .p12, run security set-key-partition-list -S apple-tool:,apple: on the keychain to pre-approve Apple's signing tools. The other classic cause is a locked keychain; unlock it with security unlock-keychain at the start of the job.

Where are my signing certificates in Keychain Access?

Under the My Certificates category of the login keychain, on the Mac where the CSR was generated. An expand arrow next to the certificate means the private key is attached. If the certificate only appears under Certificates with no arrow, that machine has the certificate but not the key, and it cannot sign or export a .p12.

Why does Xcode say my certificate has no private key?

The certificate was downloaded from the portal as a bare .cer and imported without its key. The key only exists where the CSR was created (or in the vault that generated it). Fix it by importing a .p12 exported from the original machine, or by reissuing the certificate from a new CSR if the key is gone for good.

Should CI jobs use the login keychain?

No. The robust pattern is a temporary keychain per job: create it, import the .p12, set the partition list, add it to the search list, build, then delete it. That keeps jobs reproducible, avoids interference between concurrent builds, and leaves no signing material behind on the runner.

Keep reading

Related terms

Next step

Help articles on this topic

Notice a definition that has drifted? Email support@hexsign.io and we'll update it. Browse the full glossary or jump to the help center.

Try HexSign

Know before a certificate or profile expires.

HexSign tracks every Apple certificate and provisioning profile and alerts you ahead of expiry. The Free plan covers tracking and alerts. Paid plans renew them for you.