Keychain Prompts Hanging codesign
Symptom & Root Cause
Unattended codesign or xcodebuild archive runs launched over SSH, CI runners, or background coding agents either hang indefinitely waiting for a GUI Keychain password dialog or fail immediately with errSecInternalComponent or errSecInteractionNotAllowed (User interaction is not allowed). macOS restricts private key access in login.keychain-db by process partition list and GUI session lock state, so any non-interactive signing invocation triggers an OS authorization prompt that headless tools cannot click.
Exact Diagnostic & Fix Commands
Verify available signing identities and inspect Keychain lock status:
# List valid code signing identities in the active keychain search list
security find-identity -v -p codesigning
# Inspect keychain search list and lock settings
security list-keychains -d user
security show-keychain-info ~/Library/Keychains/login.keychain-dbIf you must keep using /usr/bin/codesign in an existing script, unlock the keychain and grant partition access to Apple's signing tools:
# Unlock login keychain in the current session
security unlock-keychain -p "<KEYCHAIN_PASSWORD>" ~/Library/Keychains/login.keychain-db
# Allow codesign to access private keys without GUI prompts
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "<KEYCHAIN_PASSWORD>" ~/Library/Keychains/login.keychain-dbImport your Development identity into XCLoom once in an interactive TTY so background runs do not touch Keychain again (only pass --include-distribution on a dedicated release host):
# Inspect Keychain identities visible to XCLoom
xcloom sign list-keychain --json
# Run once in an interactive terminal (Development identity by default)
xcloom sign import-keychain --team-id <TEAM_ID>
# Dedicated release host only (adds Apple Distribution):
# xcloom sign import-keychain --team-id <TEAM_ID> --include-distributionHow XCLoom Prevents Recurrence
Running xcloom sign import-keychain requires an interactive TTY (blocking headless agents from exporting Keychain credentials automatically). Development identities are imported by default, while Distribution and Release signing require explicit --include-distribution opt-in (omitting it returns XCLOOM-SIGN-DISTRIBUTION-OPT-IN-REQUIRED). XCLoom stores an encrypted kc_<fp>.p12, a 0600 .p12.password file, and a public kc_<fp>.cer inside a 0700 team-scoped directory excluded from Time Machine backups, zeroizing secret buffers on drop. That protects against stray plaintext .key.pem files, Time Machine leaks, other macOS accounts, and headless Keychain exports without a TTY; it does not isolate against other unsandboxed processes running as the same macOS user (since the sibling .p12.password enables unattended signing).
Subsequent xcloom build, xcloom archive, and xcloom preview commands compute CMS signatures directly in process without calling Security.framework Keychain UI prompts. On an 85 MB app with 27 bundles, XCLoom completes self-signed CMS signing in 0.43s (9-run median), produces output verified by /usr/bin/codesign --verify --deep --strict, and emits XCLOOM-SIGN-KEYCHAIN-UNIMPORTED early with an actionable command if an identity has not been imported yet.
Threat model boundary: because unattended local signing reads both the 0600 .p12 and .p12.password under your macOS user account, any unsandboxed coding agent running as the same macOS user can access user-owned files. Keep coding-agent hosts on Development identities only, and isolate Apple Distribution signing to a dedicated user account or release host if you do not trust agent file reads.
Frequently Asked Questions
XCLoom generates standard Mach-O code directories and CMS signature blobs that pass /usr/bin/codesign --verify --deep --strict on macOS (0.43s self-signed CMS 9-run median on an 85 MB app with 27 bundles). Full Apple Distribution signing with RFC 3161 TSA timestamping, physical iPhone install, and App Store Connect acceptance is not yet measured on a device; standard codesign and xcodebuild remain available anytime for release signing.
No. Importing once in an interactive TTY with xcloom sign import-keychain (Development by default, or --include-distribution for Distribution/Release signing on a dedicated release user/host, or supplying --p12 / --cert + --key explicitly on CI) removes the need to pass your macOS login keychain password to security unlock-keychain.
It means XCLoom detected a valid signing certificate for your DEVELOPMENT_TEAM in macOS Keychain that has not been imported yet. Run xcloom sign import-keychain --team-id <TEAM_ID> once interactively for Development signing, or add --include-distribution for Distribution and Release signing (omitting it when Distribution signing is required returns XCLOOM-SIGN-DISTRIBUTION-OPT-IN-REQUIRED).

# Install via Homebrew (or: curl -fsSL https://xcloom.dev/install.sh | sh, installs to ~/.local/bin)
brew install xcloom/tap/xcloom
# Read-only environment and simulator check (zero changes to your project)
xcloom doctor
xcloom sim status
# Wire MCP and Agent Skills into your coding agents (repo-local by default; add --global for user-wide; zero Node)
xcloom mcp install --claude --codex --cursor
xcloom skill install --claude --codex --cursorOr paste one sentence into Claude Code, Codex, or Cursor so the agent installs the CLI, registers MCP and the agent skill, runs a first local build, and optionally installs git merge drivers or benchmarks your repo:
Read https://xcloom.dev/agent-setup.md and set up XCLoom for this repository: install the CLI, register the MCP server and agent skill, verify the environment with xcloom doctor, and run a first local build with xcloom build --local --json. Optionally install the git merge drivers and run xcloom bench --repo . --json (isolated cold xcodebuild comparison; can take several minutes on large repositories).Requires macOS with local Xcode SDKs and compilers. Runs directly on existing .xcodeproj, .xcworkspace, CocoaPods, and XcodeGen projects without format migration; standalone Package.swift apps and unsupported build rules fall back automatically to xcodebuild.