I'm running into a code signing issue with an (existing) app that I recently started working on. I haven't run into this problem with other apps built on the same computer using the same framework (Capacitor).
When I try to build the app from Xcode, either to run on a linked iPhone or to archive/publish, I get the error message: "Command PhaseScriptExecution failed with a nonzero exit code"
That script fails when running /usr/bin/codesign
and shows the message errSecInternalComponent.
I tried running the same command directly in the terminal and got the same error message.
I started going through this forum post and the initial sanity check failed. I ran this from a local terminal, not over ssh or inside tmux. I didn't get any dialog prompts when running it, though that may make sense since I was already logged in:
$ cp /usr/bin/true MyTrue
$ codesign -s "Apple Development: ..." -f MyTrue
MyTrue: replacing existing signature
MyTrue: errSecInternalComponent
$ echo $?
1
The identity I attempted to use is listed by security find-identity -p codesigning
in both the "Matching identities" and "Valid identities only" sections. Keychain Access shows that the certificate is valid.
I've tried restarting the computer. I've tried cleaning the build folder from Xcode. Any other suggestions for diagnosing and/or fixing the problem?