codesign authorization dialog hangs; XCTest re-sign fails with errSecInternalComponent while standalone signing succeeds

I’m seeing a reproducible code-signing failure on macOS 26.6.2 with Xcode 26.6 while building an iOS XCTest bundle for a physical device.

A newly created Apple Development identity is valid and can successfully sign and verify a standalone test binary using /usr/bin/codesign. However, xcodebuild build-for-testing reaches the first XCTest re-sign operation and the macOS Keychain authorization dialog for the same development private key becomes unresponsive after entering the login Keychain password and clicking “Always Allow.”

The failing command is effectively:

/usr/bin/codesign --force --sign <Apple Development SHA-1> -o runtime --timestamp=none ... libXCTestSwiftSupport.dylib

and returns:

errSecInternalComponent

The exact same development certificate successfully signs a standalone binary immediately beforehand. The build is running from an ordinary logged-in Terminal session, not SSH or CI.

After aborting the build, inspection showed the XCTest artifacts retained Apple’s original Software Signing certificate rather than the Development certificate, confirming the re-sign did not complete.

I have already recreated the login Keychain once and recreated the Apple Development identity. I do not want to make further Keychain ACL/partition changes without understanding the underlying cause.

Question: What diagnostic should I collect to determine why SecurityAgent/codesign cannot complete private-key authorization for the XCTest re-sign operation when direct signing with the same identity succeeds?

Well, that’s not good.

I’d like to clarify one point:

The exact same development certificate successfully signs a standalone binary immediately beforehand

This is specifically referring to your running codesign directly from Terminal, right?

I see two ways to interpret the above:

  • You ran codesign from Terminal, then ran xcodebuild, and then the first codesign run by xcodebuild has this problem.
  • You ran xcodebuild, it run codesign once, which worked, and then ran codesign again, which failed.

And I’d like to know which one you’re hitting.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

codesign authorization dialog hangs; XCTest re-sign fails with errSecInternalComponent while standalone signing succeeds
 
 
Q