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.
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.
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.