25

I m stuck with this error:

Code Sign error: Certificate identity 'iPhone Developer: My Name (xxx)' appears more than once in the keychain. The codesign tool requires there only be one.

I try to renew the build a new CSR, remove the old certificate, build a new one, again and again and again and this error is still present

in the keychain I dont see any duplicated certificate and if I remove the only one I can see in the keychain , Xcode complains that the certificate can't be found ...

Nico AD
  • 1,657
  • 4
  • 31
  • 51
  • (as an amendment to Inder Kumar's answer) And then click refresh. Also don't look only in keychain of your development computer - take a look at what's stored on your device (in Xcode organizer) and clean it up. – Rok Jarc Feb 20 '12 at 10:09

14 Answers14

19

Xcode 4.3 now searches all keychains for signing certificates but that is increasing the frequency of the build error:

Certificate identity (x) appears more than once in the keychain...

Apple's steps to resolve it are here: "How do I resolve the CodeSign error: Certificate identity appears more than once in the keychain?"

However, if you are affected by the keychain bug mentioned in the final note of that guide, following is a simpler and preferred solution to problem:

1) Keychain Access > Edit > Keychain List, uncheck "Shared" for the login keychain.

2) next, IF going back into the Keychain List you find the login keychain is still marked as Shared, create a backup of the following files and then remove them if they exist:

/Library/Preferences/com.apple.security-common.plist
~/Library/Preferences/com.apple.security.plist

3) Retry your build.

Bobjt
  • 4,040
  • 1
  • 29
  • 29
  • apple support already suggested me step 1 and 2 , not working , I will try 3 and 4 on monday , and yes I use XCode 4.3 – Nico AD Feb 26 '12 at 08:23
  • 2
    Removing the orphaned "Keys" from the Apple doc mentioned above did the trick for me. – Josh Metcalfe Nov 13 '12 at 13:12
  • I found that after I removed a certificated in Keychain Access > System, it still found in 'Login' category. After I removed it from 'Login', everything works like a charm! Thanks man, you saved my day. – aztack Aug 07 '13 at 08:21
5

I've had the same issue after updating XCode to 4.3. Deleting certificates and provisioning profiles didn't change anything. There were no duplicates or expired ones anyway.

It turned out the problem was that my private key was in both the session and the system keychains in the keychain access. I just had to remove it from the system keychain and i could build my projects again.

  • Thanks, this was the most helpful because I completely forgot to look at the system keychain which was causing the issue for me. Thanks! – David Rutgos Jun 07 '12 at 14:19
2

If you already deleted all other Developer Certificates in your KeyChain and the Error is still coming up, then try to delete all old/unused keys (private key) with your name. The one that's necessary, is the one with the little "folder-enhancer-icon" next to its name. Keeping this and deleting the rest fixed it for me.

matthisb
  • 1,108
  • 12
  • 29
2

I've had the same issue and I fixed it deleting every certificate from my keychain, every provisioning from my Xcode and every provisioning profile from my device and later... redone it again. I guess, It normally happens when you are working with differents profiles and you have created many certificates for the same provisioning.

TurboManolo
  • 281
  • 3
  • 15
2

I've had the same issue as well. I think you can get to this state in a variety of ways, but for me, it was because a certificate had recently expired.
What I didn't realize was that Keychain Access will hide expired certificates. Go under "View" and make sure you're not hiding the duplicate certificate.

elaydin
  • 31
  • 3
1

I had the same problem. I checked every related question I could find on SO and followed the steps - but had no luck. It kept telling me that my distribution cert appeared more than once, but I could see that it only appeared once. I revoked certificates and closed X-Code many times, but it turned out that there was a 'hidden' certificate. I had an older Distribution Certificate that was not in the login keychain. It was in an unnamed keychain. When I deleted that one, it worked! So its worth looking around keychain access thoroughly!

Shane Rayner
  • 672
  • 6
  • 8
1

After moving to a new development mac, I had this problem. I tried deleting the duplicates and checking that there were no hidden expired ones, but the error persisted. The solution that worked for me was to copy the keychain pair from the old mac and imported it in the new mac. The problem was then solved with the following:

  • select the certificate in Keychain Access
  • Expand the arrow to see the private key
  • Double click the private key
  • Click Access Control
  • Choose 'Allow all applications to use this item'
  • Click Save Changes

For me, I was then able to rebuild the app successfully.

Hope that helps someone :-)

JanB
  • 904
  • 9
  • 14
1

This works sometimes for me:

  • Delete all duplicates that you can see from the keychain (normally this step on itself does not help me)
  • Then also delete (or at least temporarily rename/move ~/Library/Developer/Xcode folder. Xcode keeps old crap/cache in there. I guess profiles exist there. Waste em. (Note that the path of this folder is changeable in Xcode prefs so if you changed the path, go there and delete stuff instead.)

Then rebuild. Worked for me this minute after getting this error the millionth time.

Jonny
  • 15,955
  • 18
  • 111
  • 232
0

Solution:

In keychain: I’ve found that if you switch to the “All Items” view, on the left hand side, the deletion seems to work every time. But maybe that was just blind luck. Even if it fails, the act of switching back and forth between “All Items” and “My Certificates” seems to force KA to refresh the view, and tells you if the delete has “worked” yet:

link:

http://viggnesh.com/blog/problem-faced/

Viggnesh
  • 247
  • 2
  • 5
0

I had this issue with XCODE 4.5, because Organizer was still keeping the developer certificates.

  • Deleted all provisioning profiles from Organizer
  • Deleted all developer certificates from KeyChain--Also show the expired list
  • Close XCode
  • Download dev certificate
  • Install Provisioning profiles
  • Clean build
  • Check organizer certificate list and make sure you got one
  • Check Keychain to make sure you got one certificate
  • Archive
Omer Cansizoglu
  • 1,271
  • 9
  • 14
0

Fixed it by Organizer -> Teams (select Your Team) -> Refresh (low right corner).

Uladzimir
  • 3,067
  • 36
  • 30
0

I deleted every certificates and provisioning profiles and restart the system and add it again, it worked.

Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
0

Just move the other cer. from "login" to "system" ... and dont delete it... Trust me

Hatim
  • 1,516
  • 1
  • 18
  • 30
0

Try to remove certificates from the xcode organizer.

Inder Kumar Rathore
  • 39,458
  • 17
  • 135
  • 184
  • And then click refresh. Also don't look only in keychain of your development computer - take a look at what's stored on your device (in Xcode organizer) and clean it up. – Rok Jarc Feb 20 '12 at 10:05
  • @rokjarc please comment on his question so that he will get notified..Thanks – Inder Kumar Rathore Feb 20 '12 at 10:07
  • certificate in organiser ? where ? I only see "provisionning profiles" in the organiser . and I already done all the clean up possible on the device (only one prov profile present) – Nico AD Feb 20 '12 at 11:04
  • then clean all your certificates from key chain and remove all mob pov from xcode org. and only install those thing which are necessary and if still this problems comes then i'm sorry i can't help. – Inder Kumar Rathore Feb 20 '12 at 14:27