Home > Back-end >  codesign fails with errSecInternalComponent: unable to build chain to self-signed root for signer
codesign fails with errSecInternalComponent: unable to build chain to self-signed root for signer

Time:07-19

I am trying to sign my app with codesign, but it fails with "errSecInternalComponent":

❯ codesign --force --deep --sign "Apple Development: ..." my.app
Warning: unable to build chain to self-signed root for signer "Apple Development: ..."
my.app: errSecInternalComponent

I tried to solve the problem like in this answer by going to KeyChain and locking all keychains and repeating the process: it asks for the keychain password, but then it still fails with the same error.

A few preliminary checks:

  • I already added my apple id to xcode
  • I created an "Apple Development Certificate"
  • if I go to KeyChain I see the certificate amongst the others, however it says that it is not trusted.

however if I run in terminal: security find-identity -v -p codesigning I get: "0 valid identities found"

I tried to remove the Apple Developer certificate from KeyChain, and download it again from developer.apple.com, and reinstalling it, but I get the same error.

CodePudding user response:

It turns out two certificates were missing:

after downloading and installing those, the security find-identity command would return one entry, and code signing would succeed.

  • Related