The Xcode / usr / bin / codesign command exited with exit code 1: errSecInternalComponent

I am trying to add a new provisioning profile to my Xcode to test the application on the device. Here are the steps I followed:

  1. Removed all certificates and provisioning profiles

  2. Create / Add IOS Dev Certificate

  3. Add my iOS device online

  4. Create IOS Provisioning Profile

  5. Add IOS Provisioning Profile

  6. Clean application

  7. Build and Run Application

  8. Install Codesigning and Provisioning Profile in Build Settings

  9. Googling a lot> unsuccessfully

Here is the error I get:

CSSM_SignData returned: 800108E6 /Users/alexpelletier/Library/Developer/Xcode/DerivedData/MyExpense-efnqzvoqwngzcmazaotyalepiice/Build/Products/Debug-iphoneos/MyExpense.app: errSecInternalComponent Command /usr/bin/codesign failed with exit code 1 
+76
source share
14 answers

Grant access to the keychain , then select Lock All Keychains from the File menu.

Then go back to Xcode, clean and restore. He will again ask for your password to unlock the keychain.

After that, if you have no other problems with compilation, everything will be successful!

+174
source

It seems that an error in the code signing mechanism, restarting your mac should solve the problem.

+77
source

This occurs when the login keychain is locked. To unlock the login keychain, do:

 security unlock-keychain login.keychain 

Then try assembling or signing the code again. The error code in question is described in the Apple documentation as an internal error, so it is possible that this happens in other cases.

+56
source

If errSecInternalComponent the same problem in High Sierra / Xcode 9.4.1 , all signing attempts have errSecInternalComponent

    • Go to Keychain Access
    • Go to the keychain to enter
    • Select the My Certificates category.
    • Find the certificate with which you sign and open it to see the key.
    • Double click key
    • Click on the "Access Control" tab.
    • Update key access control to "Allow all applications access to this item"

As an alternative:

run the codeign command on a Mac terminal and "Always allow" / usr / bin / codesign key access

  1. If you are trying to sign from SSH / CI, you also need to run

     security unlock-keychain login.keychain 

    before you try to sign the application suite

+22
source

I encountered the same problem, I restart MacOS and it works.

In China, we have a saying among developers:

Little problems, just reboot. Big problems must reinstall.

Sometimes the above will help you a lot!

+15
source

In case this helps someone else, I encountered an errSecInternalComponent error with codesign because I was codesign it through an ssh session on my macOS machine. Running the same command from a terminal window on a MacOS machine itself worked.

Presumably, this is because codesign requires access to the private key from the login keychain.

Running security unlock-keychain login.keychain (as explained in cbracken's answer ) from the same session should also work.

+6
source

If you are trying to sign the ssh run command:

 security unlock-keychain login.keychain 

before you try to sign the application suite

or from the interface

Update key access control to "Allow all applications access to this item"

Thanks @Equilibrium and @Jon McClung

+2
source

I started the security unlock-keychain login.keychain and my login password did not work. So I rebooted and then just started Xcode again, and it worked. Running a team works as well. Weird question.

+2
source

Just try once using a Mac terminal, but not from an ssh session

 security unlock-keychain login.keychain 

And select always allow in the dialog box. And then you could xcodebuild in a remote session.

+1
source

I had the same problem. Found that the problem with signing the application code.

 Opened the developer account and accepted the updated agreement and it worked. 

enter image description here

+1
source

Restarting mac does not always work and is not the right solution, I still experience similar problems in CI trying to build Debug mode

0
source

As pointed out by @Equilibrium in one of the comments, if you are on the env command line. like Jenkins (in my case), you may need to pass the password to the security-unlock command mentioned in the solutions.

Therefore, instead of using

 security unlock-keychain login.keychain 

using:

 security unlock-keychain -p <login-keychain-password> <path-to-login-keychain> 

where the key chain for login can be $ HOME / Library / Keychains / login.keychain (in my case) or just login.keychain

0
source

for those who have encountered this problem from jenkins and ssh:

the high probability that you did not provide access to the private key in the keychain, I tried, but I'm not sure why they all do not work:

  1. import .p12 security file with -A or -T / usr / bin / codesign
  2. security key set -L ist -S apple -T ool :, apple :, code :: -S -k # {password} # {keychainPath}
  3. change the entire provisioning profile to [UUID] .mobileprovision and copy them to "~ / Library / MobileDevice / Provisioning \ Profiles" on the jenkins server
  4. clear received data and restart jenkins server
  5. make sure that the default keychain is the keyring to enter and unlock it.

finally resolved using:

1.ssh [user] @ [jenkinsServerIP] -L 5900: localhost: 5900, log in to jenkins server

2. open 'vnc: // localhost'

this will launch a remote screen if your jenkins server allows this ...

then open keychain.app to grant / usr / bin / codesign access to the private key

good luck

0
source

Right-clicking on the private key associated with the code label in the keychain, and then clicking on "allow all applications", instead of relying on a hint, fixed it for me, because the assembly took place via ssh.

0
source

Source: https://habr.com/ru/post/970268/


All Articles