Skip to content
Latchkey

xcodebuild "Unable to log in with account" during signing in CI

Automatic signing tried to authenticate to the Apple Developer account to fetch or create a profile, but the CI runner has no signed-in account, so the login fails. Headless CI should use manual signing instead.

What this error means

xcodebuild fails with "The operation couldn't be completed. Unable to log in with account '...'." while resolving signing, usually with CODE_SIGN_STYLE set to Automatic.

xcodebuild
error: The operation couldn't be completed. Unable to log in with account
'ci@example.com'. The login details for the account could not be found.
(in target 'App' from project 'App')

Common causes

Automatic signing on a headless runner

Automatic signing needs a logged-in Apple ID in Xcode to talk to the developer portal; CI has none, so the login step fails.

Relying on the account to generate profiles at build time

The build expects Xcode to create or download a profile on demand, which requires interactive account access not available in CI.

How to fix it

Switch to manual signing in CI

  1. Set CODE_SIGN_STYLE to Manual.
  2. Import the certificate (.p12) and provisioning profile onto the runner.
  3. Pass the explicit provisioning profile and team id to xcodebuild.
Terminal
xcodebuild -scheme App archive \
  CODE_SIGN_STYLE=Manual \
  DEVELOPMENT_TEAM=ABCDE12345 \
  PROVISIONING_PROFILE_SPECIFIER="App Distribution"

Use App Store Connect API keys for signing tasks

For operations that genuinely need the account (creating profiles via fastlane), authenticate with an App Store Connect API key instead of an interactive login.

Terminal
fastlane match appstore --api-key-path key.json

How to prevent it

  • Never use automatic signing on headless CI runners.
  • Pre-install certificates and profiles; pass them explicitly.
  • Use App Store Connect API keys instead of Apple ID logins in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →