[ACCEPTED]-/usr/bin/codesign failed with exit code 1-code-signing

Accepted answer
Score: 55

The Technical Note in my original answer 10 is now deprecated. Apple posted a collection 9 of code signing problems (and some solutions) in 8 a new document: Technical Note TN2407 Code Signing Troubleshooting Index

Check the CODE_SIGN_IDENTITY 7 property in your build settings. Is your 6 provisioning profile selected there?
You 5 also need to enter a valid bundle identifier 4 in your apps .plist.
The identifier has 3 to match the one you provided when generating 2 the profile.
Apple has a technote about 1 that here.

Score: 25

I just came across this error, and here's 8 what I found out in case this helps anyone: I 7 discovered that you can right click the 6 error message in Xcode and choose expand 5 to get more details, including a description 4 of the problem.

In my case, I had two copies 3 of my developer certificate with the same 2 name in different keychain files, and Xcode 1 couldn't figure out which one to use.

Score: 18

It might be strange answer for codesign 7 issue in Xcode 9.0. I was receiving this 6 error too and did not know what to be done, because 5 everything was correct.

I went to the keychain, I 4 had the login option "unlocked". I locked 3 it and compiled my build again. Xcode itself 2 asked me to open access keychain. I gave 1 access and it worked.

Steps were:

  1. Go to keychain
  2. Lock it
  3. Archive the code, build the project again
Score: 14

I had the exact same error, and tried everything 15 under the sun, including what was elsewhere 14 on this page, with no success. What the 13 problem was for me was that in Keychain 12 Access, the actual Apple WWDR certificate 11 was marked as "Always Trust". It needed to be "System Defaults". That 10 goes for your Development and Distribution 9 certificates, too. If any of them are incorrectly 8 set to "Always Trust", that can apparently cause this 7 problem.

So, in Keychain Access, click on 6 the Apple Worldwide Developer Relations 5 Certificate Authority certificate, select 4 Get Info. Then, expand the Trust settings, and 3 for the combo box for "When using this certificate:", choose "System Defaults".

Others 2 have commented that you may have to do this 1 in System and login keychains for these errors.

Score: 10

There could be a lot of reason when you 7 get this kind of error:

  1. Check whether you 6 have selected a provisioning profile which 5 includes the valid Code Signing Identity and a valid Bundle Identifier in Settings. (Goto 4 Build Settings->Signing->Provisioning 3 Profile).

  2. Open Keychain Access and click on lock icon at 2 top left, so it will lock the login keychain 1 and then again click to unlock.

enter image description here

  1. Goto File->Project Settings->Derived Data and delete your project build folder. After that clean and build your app.
Score: 6

I had the same problem the distribution 21 build. It just happened all of sudden. In 20 fact I did not have this problem a few days 19 ago and I had my Ad-Hoc version compile 18 right. This issue came up because my certificate 17 just expired today. So I went create a new 16 provisional following Apple's guidance: (http://developer.apple.com/ios/manage/distribution/index.action).

After 15 spending hours on the net and made sure 14 I had not fallen for what could go wrong. Here 13 is what save me as suggested by Tobias and 12 Dan Ray:

  1. "...discovered that you can right click the error message in Xcode to view details".
  2. "...the issue was an expired certificate on my System keychain. Keychain Access doesn't, by default, show expired certs".

The detailed information told me 11 about ambiguous matching two certificates. One 10 of them happened to be an expired certificate 9 in the System key chain. So I deleted the 8 expired one then it worked! I also had a 7 concern about what to enter in the "common 6 name" when create the distribution certificate 5 using the keychain utility: my name or my 4 company name. In my case, I entered my name. I 3 am guessing it is the same as the title 2 that addressed by the developer's auto responder 1 email.

Great help. Thanks.

Score: 3

If the error immediately preceding the codesign 4 error says something like 'resource fork, Finder 3 information, or similar detritus not allowed'

Then 2 navigate to the .app file in Terminal and 1 type:

xattr -cr < path_to_app_bundle >

ref: https://developer.apple.com/library/content/qa/qa1940/_index.html

Score: 2

What worked for me was adding --deep to Other Code Signing Flags in Build 3 Settings. More information here: Codesign of Dropbox API fails in Xcode 4.6.3: "code object is not signed at all"

Unfortunate 2 that this ambiguous error condition has 1 400 different solutions, but I digress.

Score: 1

I had the same problem. In the end it turned 3 out that my private key did not allow codesign 2 to access it. One can see this in the info 1 dialog in keychain application.

Score: 1

I have to agree with Tobias. The error 5 is too generic. When the same thing happened 4 to me I dug into the error message and realized 3 I'd screwed up something in the build properties, but 2 not the code signing. So yeah, I'd dig 1 in to the details.

Score: 1

In my case error was due to the fact that 4 I had two keys on the keychain with the 3 same name. I deleted the old one and that 2 solved the issue.

Going to the detail message 1 show the real problem to me.

Score: 1

after hours of googling and trying out different 10 things, this is what fixed it for me:

  1. Make 9 sure there are no certificates in the System 8 > Certificates tab on Keychain Access. Remove 7 all duplicate certificates from there.

  2. Install 6 the WWDR intermediate certificate under 5 certificates from the provisioning portal, in 4 addition to the developers certificates 3 and make sure you see it in the Login > Certificates 2 tab on Keychain Access.

hope this helps some 1 of you!

Score: 1

Same issue with ambiguous (matches "iPhone 4 Developer: [me] " and /// tweetdeck's library 3 privatedata file. Fixed it by moving file 2 to the trash and re-logging into Tweetdeck, setting 1 up passwords again. What a pain.

Score: 1

I had the same problem but also listed in 7 the error log was this: CSSMERR_TP_CERT_NOT_VALID_YET

Looking 6 at the certificate in KeyChain showed a 5 similar message. The problem was due to 4 my Mac's system clock being set incorrectly. As 3 soon as I set the correct region/time, the 2 certificate was marked as valid and I could 1 build and run my app on the iPhone

Score: 1

I was also getting this error ("/usr/bin/codesign 11 failed with exit code 1"), and when I looked 10 in Keychain Access my developer certificates 9 were marked as "This certificate was signed 8 by an unknown authority". I had recently 7 upgraded to Mac OS 10.8 and have had a couple 6 of other XCode (4.5.2) issues since then. It 5 turns out I did not have the WWDR intermediate 4 certificate installed. I downloaded that 3 from the iOS Provisioning Portal, installed 2 that in Keychain Access, and my project 1 builds again!

Score: 1

When I got this error I wasn't even trying 5 to sign the app. I was writing a test app 4 and didn't care about signing. In order 3 to get rid of this message I had to select 2 "Don't Code Sign" from Build Settings under 1 Code Signing.

enter image description here

Score: 1

Sometimes your build folder simply needs 2 cleaning - it certainly worked for me. Thanks 1 to loafer-project for the solution.

Score: 0

One possible cause is that you doesn't have 3 permission to write on the build directory.

Solution: Delete 2 all build directory on your project folder 1 and rebuild your application.

Score: 0

I just came across this error and it was 9 because I was trying to write the build 8 file to a network drive that was not working. Tried 7 again from my desktop and it worked just 6 fine. (You may have to "Clean" the build 5 after you move it. Just choose "Clean all 4 Targets" from the "Build" drop-down menu).

Tobias 3 is correct though, dig into the details 2 on the code by right-clicking it to see 1 what your specific problem is.

Score: 0

One thing that you'll want to watch out 7 for (it's a stupid mistake on my part, but 6 it happens), is that the email address attached 5 to the CSR needs to be the same as the email 4 connected to your Apple Dev account. Once 3 I used a new CSR and rebuilt all the certs 2 and provisioning profiles, all was well 1 in applesville.

Score: 0

Another reason, Check your Developer account 1 is connected with xCode

enter image description here

Score: 0

Kinda old question, but still happens it 5 seems. Another solution:

Occurred for me 4 after reverting a branch in git. Tried 3 cleaning, cleaning builds, deleting derived 2 and restarting Xcode, but no luck.

Try rebooting 1 the comp.

Score: 0

I had the same unknown error from codesigning 7 that you mentioned. Similar to the answer 6 provided (but a little different), I just 5 locked my keychain access and unlocked it, and 4 I was able to build and run to my device 3 again. If anyone has the same issue, perhaps 2 try that first before going through the 1 trouble of modifying the keychain password.

Score: 0

Throwing my comments into the ring, I just 34 came across this after attempting to refresh 33 my development environment after clicking 32 DENY accidentally on one of the application 31 requests, after searching around I found 30 a number of things that didn't seem to work. This 29 is the full order in which I've attempted 28 the fixes and whether there was a success:

1) Attempted 27 to clear the DerivedFiles and restart XCode 26 - no dice

2) Attempted to Log and Unlock 25 the Keychain, then restart XCode - no dice

3) Attempted 24 to refresh my developer account within XCode 23 - no dice

4) Bit the bullet and just reset 22 my entire keychain, after doing so my developer 21 account was signed out (signed back in), then 20 restarted XCode - no dice

5) Found an article 19 on here that said that we needed to set 18 the [login|local|System]/certificate/Apple 17 Worldwide Developer Relations Certificate 16 Authority to "System default". But in my 15 case it was already set to system default 14 - no dice

6) Then I looked at my actual developer 13 certificate login/my certificates/Mac Developer: and 12 when I looked in there it was correctly 11 set to Confirm before allowing access BUT 10 there was no entries in the lower section. There 9 should be [Xcode, codesign, productbuild]. I 8 deleted the certificate entry and restarted 7 XCode - bingo

The certificate was added and 6 I was then prompted. So what did I do, I 5 pressed "always allow" and then just boned 4 myself.

I had to go back and delete the 3 certificate again, then go through about 2 20 allow dialogs during a clean build. Once 1 completed, I was able to build completely.

Score: 0

In My Case, after a fews days of research,

All 4 I did to revolve is listed below:

  1. delete all the certificate on your keychain.
  2. goto your apple account. a) download the specify certificate your want to install on your keychain. b)(Optional) Also create and download the require profile.
  3. in Xcode, clean your project. This may take some time.
  4. Build your project.

This should 3 work for similar codesign issues.

Note, during 2 this process the OS would ask for your credential 1 validation.

Score: 0

I use Xamarin and for me this is what worked 5 after trying everything else. In Visual 4 Studio for Mac I've opened a .xib file so 3 it opens the project in Xcode.

Went to the 2 project settings > Signing and Capabilities, selected 1 the team and then fixed the Signing Certificate.

Score: 0

I think the issue is with the Keychain Access 5 and certificate trust.

Try adding the following 4 certificate Apple Worldwide Developer Relations Certification Authority from https://www.apple.com/certificateauthority/ (Expiry validity 2030)

The 3 trust warning indicated in certificate will 2 be fixed and then try building the iOS application 1 again

More Related questions