Search code examples
iosxcodejenkinscertificatexcodebuild

xcodebuild returning code sign error


Check dependencies Code Sign error: The identity 'iPhone Distribution: XXX' doesn't match any valid, non-expired certificate/private key pair in your keychains

This is the constant message that I'm getting from the xcodebuild command. From Xcode, I have no trouble building the application with the same code sign and scheme.

I have tried:

  • Fresh installing the command line tools
  • Trying with fresh provisioning profile, certificate and key
  • Locking, unlocking, setting timers, removing timers from the keychains

and many many more

The weird thing is that on another Mac with the same profile, certificate, key, command line tools, Xcode version, and keychain configuration, the xcodebuild command works as expected.


Solution

  • The jenkins was started before the login of the user so the jenkins didn't have access to the user's keychain. The fix was to start the jenkins with the user login.