Reputation: 5570
I am getting this error:
CodeSign error: Certificate identity 'iPhone Developer: XXX' appears more than once in the keychain. The codesign tool requires there only be one.
At first I though, no worries, I will just go into keychain and delete the duplicate (older) one, which I did. I went back, closed Xcode, reopened Xcode and project, same error. wtf I though to myself. Back into keychain and the cert is there again. I delete both certs, repeat, and notice as the project loads, the two certs I deleted pop back into the keychain.
After much searching, I ensured I did not have the cert in the system keychain, which I did not. Also did a clean and rebuild. When I had duplicates with Xcode 3 I could just clean up the keychain duplicate and I was good. But with Xcode 4 it literally just reinstalls them somehow when I open the project. I even deleted all .cer files on my system that it might possibly be pulling them from.
Any suggestions?
Upvotes: 85
Views: 32867
Reputation: 9453
Xcode 4 has a new feature "Automatic Device Provisioning". It's located in the organizer under library/provisioning profiles. If you have this enabled it will automatically download your provisioning profiles from the apple developer provisioning server and thus you get the error of having duplicates. The easiest way to fix it is to delete all provisioning profiles and press refresh for the "Automatic Device Provisioning". This will load your provisioning profiles from the server and will fix your problem.
Upvotes: 11
Reputation: 11
Figured out a really easy way to fix this in 4.6.1. You can do it without restarting anything or deleting any profiles!
With Keychain Access and your Xcode project open:
Hope it helps!
Upvotes: 1
Reputation: 3939
Just installed Xcode 4.6.1 and started having this problem again. The last time was a long time back. I deleted the old provisioning profiles and the certificates, but still could not build.
This time it turns out that I had 2 certificates listed for me in the team account of the developer portal. The first was expired, the second was not. Xcode kept grabbing the first one it found while refreshing (or maybe both).
I deleted both certificates from the keychain, then manually downloaded the good one from Apple's portal and manually added it to the keychain. Now I can build again.
(And I sent a request to the team admin to remove the old certificate.)
Upvotes: 0
Reputation: 2608
-- EDIT --
Merge @Codezy's answer and @iphone007's comment.
Upvotes: 6
Reputation: 12465
The other reason that xcode keeps installing your certificate is because you did not delete key, only certificate. You need to delete private key (and corresponding public key) as well as certificate in keychain otherwise xcode will reinstall the certificate.
Check here To remove development and distribution certificates from your keychain
Upvotes: 0
Reputation: 9
For what it's worth, @AndreasPrang, your answer worked when all of the above didn't. I could see the expired certificate was not anywhere in the keychain, yet when I did a build, Xcode said it was. Deleting the provisioning profiles (all of them), selecting my name in the Team section and clicking the refresh icon in the lower right of the organizer also did not help. Restarting Xcode didn't help, but shutting down XCode, deleting ~/Library/Developer/Xcode did. When I restarted XCode, it rebuilt everything and was happy.
Upvotes: 0
Reputation: 33369
Quoting an answer to a duplicate of this question, some of Xcode's bugs in this area can only be solved by restarting OS X.
In the end, I achieved success by deleting everything mentioned in any of the answers to this question, restarting, then manually installing the parts I needed (I did not trust/try the automatic profile/certificate download feature).
Upvotes: 0
Reputation: 122
I spent for this a half-day and finally found the solution
Then close Keychain.app and go to Xcode -> Organizer
Build again your app:)
Upvotes: 2
Reputation: 1889
the above method not work for my case
finally , i go to keychain
and search the key by entering the name
i finally found the cert which is supposed to be deleted before . then i deleted it and the problem solved
it's really frustrating , and i don't know whether it's the bug ....... really exhausting.
Upvotes: 0
Reputation: 2561
I had this same problem and the solutions above did not solve my problem (well nearly).
I had the same duplicate developer ID/certificate that everyone is complaining about, and I tried deleting all my profiles, revoking/reissuing my cert, making sure there were none in the system keychain, restarting, etc etc.
In the end it turned out there was a certificate in the system keychain, one that had expired and so was hidden by default in the list.
Make sure you can see expired certificates in KeyChain
To do this:
Upvotes: 33
Reputation: 11
I've tried everything suggested here but nothing worked for me except reinstaling XCode 4.3 magically solved the case.
Upvotes: 1
Reputation: 356
For posterity, here's the strategy to get around this problem in our automated build script:
Upvotes: 1
Reputation: 71
if you want to mess with keychain access to remove the expired certificate, you may try this:
the expired certificate disappears together with the keychain. worked perfectly for me.
Upvotes: 7
Reputation: 2540
Deleting provisioning profiles in Organizer's library, additionally, you should delete iPhone developer certificate in Keychain Access. (The certificate's name is probably like "iPhone Developer: XXXXX ..." and indicated by red X sign, as expired)
Upvotes: 2
Reputation: 5570
The solution was to go into organizer - under library - provisioning profiles, delete all of them and then reinstall any profiles I still needed.
Upvotes: 103