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
securitycommand 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-authorizecodesignto access the private key. For the exact subcommands and parameters, followman security. - fastlane wraps this flow up:
setup_cicreates 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.
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
- Archive once by hand in the remote desktop to confirm the certificate and provisioning profile themselves are fine.
- Write a script that creates the dedicated keychain, imports the
.p12, unlocks it and sets access control on the private key. - Store the contents of the
.p12and the two passwords in the CI platform's secret variables. - In the pipeline, run this script before the build and delete the keychain after the build.
- Restart the machine once, trigger a build again, and verify the whole process needs no manual clicks.
Related questions
- Can code signing on a build machine be fully automated with no prompts?
- Which user account does a CI runner run as on a rented Mac?
- How do I sign an iOS app and upload it to the App Store from a remote Mac?
- Runner did not come back online after the Mac mini restarted: what to do
- Rented Mac mini as an always-on build machine for small teams? Count your build minutes first
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:
- Can I install a CI runner as a system boot service on a rented Mac mini?
- Can I just use my everyday development Mac as a CI runner?
- Can a cheap Linux machine build iOS apps, with a Mac only when needed?
- Only one build machine: should I keep a cloud runner as a backup?
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support