robsnider
4/12/2016 - 2:41 AM

Rebuild OSX Keychain

Rebuild OSX Keychain

Create a new login keychain and copy the contents of the old keychain into the new.

Close Keychain Access. Open Terminal and make a backup of your login keychain.

cp ~/Library/Keychains/login.keychain{,-old}

You now have two keychains in your keychain folder named login.keychain and login.keychain-old. The latter is an identical copy of the original keychain.
Move login.keychain to your desktop and rename it with the following command:

mv ~/Library/Keychains/login.keychain ~/Desktop/login1.keychain

Now, create a new, empty login keychain:

touch ~/Library/Keychains/login.keychain

Exit Terminal. Open Keychain Access. The login keychain will be empty.

On your Desktop, double click login1.keychain

Within Keychain Access, unlock login1.keychain and copy all of its contents into the new, empty login.keychain

Right click (or Control + click) login1.keychain and select "Delete References and Files"

Attempt to import your certificates.