Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to restore keychain

Hi,


Assuming I have a complete backup of my previous OS X installation, how should I re-install my keychains back to the new OS, after fresh install?


OS: Yosemite


Thanks,

Kasra

MacBook Pro, OS X Yosemite (10.10.2)

Posted on Feb 20, 2015 7:53 PM

Reply
6 replies

Feb 21, 2015 1:54 PM in response to kasrafromwatson

Keychain information is stored in your user library/Keychains.


Go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J. When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder. Select Library.

Feb 22, 2015 1:34 AM in response to Drew Reece

Thanks Drew,


My problem is exactly here! The OS specific keychains migrate smoothly via iCloud keychain and you even don't need to migrate them manually. The problem begins with other keychains that I've made myself. All I know from the web is I have to also copy a file named "systemkey" from /var/ director. But that's all I know.


Warm Regards,
Kasra

Feb 22, 2015 1:01 PM in response to kasrafromwatson

I don't think you want to meddle with the system keychain. If you replaced that you may want to restore the original one. It's unclear to me what it holds beyond the fact that I should not touch it, I think it is created via the installer, or some post install scripts during setup.


Wifi passwords will be stored in system keychain and some other certificates. Generally you enter wifi details as an admin user & then the OS takes over saving them to the system keychain. I can't think of any other reason for wanting to migrate the system keychain.

The only ones I migrate are the ones in the user Libraries.

Apr 6, 2015 10:22 AM in response to kasrafromwatson

Dear kasrafromwatson you have all the right to be annoyed with the absurdity and chaos that is Keychain. It is even worse than its relative IPhoto.

While iPhoto is antisocial and aggressive in hiding every single photo u feed him (reminds me of Gollum in Lord of the rings... My Preciouuuussss) sp that no other application can take that responsibility from him (like Picasa, Acdsee and adobe), the keychain did surpass others in grotesque.. Always a mess, old **** u dont use, new **** come magically, it is a master of disguise..

Never here when u need him to fill a password in Iphone btw.. and works only with Safari not mozilla or Chrome.. add impossible to copy or share.. a fortress of incovenience!

USE A PASSWORD MANAGER like LASTPASS: 10 $ a year and u feel v tidy and safe..!

Sometimes i wonder whats in the mind of people in apple company! i think they worry more about inventions protection sometimes..


NOW Do this:


You're absolutely right have to take that system key file "Systemkey" from /var/db/Systemkey because this this is how you unlock the keychain . Don't forget to backup .keychain files located in both

/Library/Keychains
and
~/Library/Keychains folders


This command can make your life easier, it will copy Keychain files and corresponding key to a folder u choose: 

sudo cp /Library/Keychains/System.keychain /var/db/SystemKey ~/Library/Keychains/login.keychain [BACKUP_PATH]

Replace

[BACKUP_PATH]
with the path of your backup folder or USB to take these files.


Lastly, on your new OS X installation, restore the keychain files with these commands:

KEYCHAINS=[BACKUP_PATH]

sudo cp $KEYCHAINS/login.keychain ~/Library/Keychains/login.keychain && sudo cp $KEYCHAINS/System.keychain /Library/Keychains/System.keychain && sudo cp $KEYCHAINS/SystemKey /var/db/SystemKey

Again, replace

[BACKUP_PATH]
with the location in which you backed up your Keychain files,
KEYCHAINS=/Volumes/Thumbdrive/Keychains
for instance.


Be aware that this will overwrite your fresh keychains so make sure they don’t contain any passwords you may have saved since re-installing OS X. In effect, this should be preformed immediately after re-installing.

Having copied the System Key, you should now be able to successfully unlock the System Keychain on your new OS X installation.


Further reading and sources:


http://www.sebastiencouture.com/post/88839839716/backup-restore-system-keychain- os-x

http://osxdaily.com/2012/07/05/copy-keychain-login-passwords-between-macs/

How to restore keychain

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.