Tag Archives: Protip

Getting rid of old certificates in Xcode

Xcode 4.x’s Organizer window has an annoying habit of not only keeping old certificates (whether expired, revoked, duplicated, or otherwise redundant) around, but also restoring them every time you try to delete them. There’s no interface in Xcode for removing these extraneous identities and nothing sees to work for getting rid of them. Here’s what I originally tried, more or less in order and starting from the beginning with another step added every time:

  1. Deleting certs and keys from Keychain Access
  2. Deleting certs and keys with the security command
  3. Restarting Xcode
  4. Restarting computer
  5. Ditching ~/Library/Caches/*{Xcode,Developer}*
  6. Ditching ~/Library/Preferences/*{Xcode,Developer}*
  7. Ditching ~/Library/Developer (while saving only my keybindings and font/color settings)
  8. Removing all archives from the Organizer
  9. Grepping my entire home directory for the certificate name (four hours taken)
  10. Grepping my entire computer for the certificate name (2.5 days taken as I couldn’t figure out a command that excluded sending it down several recursive directories that led back to / – I could’ve, but I was lazy).

I finally ferreted out the final hiding place of Xcode’s ridiculous cache of certificates in /var/folders/<some random alphanumeric characters here>/com.apple.{dt.Xcode,Xcode.501,Developer} (or something very similar). When I deleted that and all of the other things mentioned above, the offending/offensive identities finally vanished.

tl;dr: To make sure you’ve really killed Xcode’s cache, make sure you clear out the area Apple deliberately made hard to find and set as $TMPDIR as a so-called security measure.