security unlock-keychain login.keychain in Terminal.Why this happens
When Xcode attempts to sign your app, it needs access to the private keys and certificates stored in your login keychain. If that keychain is locked — either because the system locked it after inactivity, a restart, or a policy — the codesign tool cannot read the signing identity. The result is an internal security framework error (CSSM_SignData returned: 800108E6) surfaced as errSecInternalComponent with exit code 1.
This commonly appears after:
– A Mac restart or sleep/wake cycle
– Keychain access policy changes
– Switching between user accounts
– CI/CD agents that start with a locked keychain
The error message is misleading because it looks like a certificate or provisioning profile problem, but the root cause is simply keychain accessibility.
How to fix it
1. Lock and unlock via Keychain Access (most reliable)
This is the standard interactive fix. It forces the keychain into a known state and prompts for your login password when Xcode next needs it.
- Open Keychain Access (Applications > Utilities or press ⌘Space and search).
- In the menu bar, choose File > Lock All Keychains.
- Return to Xcode.
- Choose Product > Clean Build Folder (⇧⌘K).
- Build and run (⌘R).
- When the dialog appears asking to allow codesign to access the keychain, enter your macOS login password and click Allow (or Always Allow to avoid future prompts).
The build should now succeed, assuming no other signing issues exist.
2. Unlock from Terminal (for scripts and CI)
When you can’t interact with the GUI — for example on a headless build runner — use the security command line tool.
# Unlock interactively (prompts for password)
security unlock-keychain login.keychain
For automated environments, pass the password non-interactively:
# Replace PASSWORD with your actual login keychain password
security unlock-keychain -p PASSWORD login.keychain
Security note: In CI systems (GitHub Actions, Bitrise, CircleCI, etc.), store the password as a secret variable and inject it at runtime. Never hard-code credentials in repository scripts.
After unlocking, run your normal build command:
xcodebuild clean build -scheme YourScheme -destination 'platform=iOS,name=Your Device'
3. Verify keychain settings if the problem recurs
If you unlock the keychain but the error returns on the next build, check these settings:
- In Keychain Access, select login keychain in the sidebar.
- Choose File > Change Settings for Keychain “login”.
- Ensure “Lock after X minutes of inactivity” is either unchecked or set to a generous interval.
- Ensure “Lock when sleeping” matches your workflow (disable if you frequently sleep the Mac between builds).
Also confirm the keychain is using the default password (your login password). If you changed the keychain password independently, security unlock-keychain will need that specific password, not your user password.
How to prevent it
- Keep the login keychain unlocked during development sessions by adjusting the auto-lock timeout in Keychain Access settings.
- Add the password to your CI secrets and call
security unlock-keychain -p $KEYCHAIN_PASSWORD login.keychainas a pre-build step. - Use a dedicated signing keychain for CI (create with
security create-keychain -p $PASSWORD ci.keychain, import certificates, thensecurity list-keychains -s ci.keychain login.keychain). This isolates CI from your personal keychain state. - Avoid manual keychain locking scripts or third-party tools that lock the keychain aggressively.
FAQ
Does this error mean my certificate or provisioning profile is invalid?
No. The errSecInternalComponent / CSSM_SignData 800108E6 error specifically indicates the codesign tool cannot access the private key because the keychain is locked. Your certificates and profiles are likely fine — unlock the keychain first, then re-verify if signing still fails.
Why does Xcode sometimes work without unlocking and sometimes fail?
macOS locks the login keychain after a configurable period of inactivity, on sleep, or after a restart. If you build frequently, the keychain stays unlocked. A break longer than the timeout (default 5–15 minutes) or a sleep/wake cycle will lock it again, causing the next build to fail.
Can I use Always Allow in the keychain prompt to stop future prompts?
Yes. When the dialog appears asking for permission to access the keychain, choose Always Allow instead of Allow. This adds an ACL entry so codesign can read the key without prompting, even after the keychain unlocks. Do this for each signing identity (Developer ID, Distribution, etc.) the first time it’s used after unlocking.
Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.