Home/Q&A/Locked keychain or signing error in CI on a rented Mac: how to fix it

Locked keychain or signing error in CI on a rented Mac: how to fix it

Updated · airankrush

Direct answer

It can be fixed. Create a separate keychain for the signing certificates and let the pipeline unlock it with that keychain's own password. Do not rely on the login keychain, and do not put the Mac login password into CI.

Basis

  • The login keychain is unlocked with the login password when the user logs in to the desktop. A runner in the logged-in user's session can usually use it, but an unattended build fails or hangs when the keychain locks automatically, when the machine has restarted and nobody is logged in, or when the system shows a dialog asking whether to allow access to the key.
  • The dependable approach is a dedicated keychain: use the security command that ships with macOS to create a keychain with its own password, import the certificate and private key into it, unlock it and add it to the search list before the build, and pre-authorize codesign to access the private key. For the exact subcommands and parameters, follow man security.
  • fastlane wraps this flow up: setup_ci creates a temporary keychain for match to use (setup_ci, checked 2026-11-12).
  • The dedicated keychain's password is a random value you choose, stored in the CI platform's secret variables, and has nothing to do with this Mac's login password.

Information as of .

Boundaries: when the answer is different

Do not put the Mac login password into pipeline variables to unlock the login keychain. That password is also the one used for system authentication, and a leak affects the whole machine. If keychain prompts or authentication failures appear after you have changed or reset the macOS login password, contact support; do not empty the keychain or system folders yourself. The first time a given private key is used for signing, it is best to build once by hand in the remote desktop and deal with the permission prompt that appears. Certificates and private keys are yours to safeguard, and remember to delete them from the machine before the rental ends.

How to do it

  1. Archive once by hand in the remote desktop to confirm the certificate and provisioning profile themselves are fine.
  2. Write a script that creates the dedicated keychain, imports the .p12, unlocks it and sets access control on the private key.
  3. Store the contents of the .p12 and the two passwords in the CI platform's secret variables.
  4. In the pipeline, run this script before the build and delete the keychain after the build.
  5. Restart the machine once, trigger a build again, and verify the whole process needs no manual clicks.

Use case

This question belongs to the use case: Rented Mac mini as an always-on build machine for small teams? Count your build minutes first

Other questions in the same use case:

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All Q&A