Remember to backup your keychain

I cannot believe another year has gone by and I need to renew my iOS development certificate again. Luckily I left myself a reminder last year on how to do it. Even though I should know by now it still caught me by surprise when I saw the messages warning me that I did not have a valid signing certificate.

Unfortunately in the process of deleting the old, expired development key from my keychain I had a problem with fat fingers and managed to delete something I should not have done. Luckily I have several different mechanisms to backup my keychain. In addition to an hourly backup by Time Machine I also have Super Duper making a full bootable clone of my OS X disk and a separate backup copying key data up to the cloud.

Restoring the Keychain

The keychain files are stored under the users home directory at ~/Library/Keychains. To restore the login keychain I just needed to restore the login.keychain file from the previous backup and I was back in business. The moral of the story is of course to check that you are backing up your Mac. In my experience user failure is at least as common as hard drive failure and it is good to know that you can recover quickly when the inevitable happens.

One other quick tip on the keychain whilst I am on the topic. You should from time to time check the health of the keychain. You can do this by running the Keychain Access utility and using the Keychain First Aid option in the Keychain Access menu. After you enter your password you can verify the state of the keychain and repair any errors.