Copy Keychain Logins & Passwords from One Mac to Another

Jul 5, 2012 - 21 Comments

Copy Keychain login and passwords between Macs

Most Mac users are best served by using the easy Migration Assistant tool to copy all files, folders, preferences, and login data from one computer to another. This isn’t always an option though, perhaps because a hard drive is failing, or maybe you just prefer to manually migrate only very specific data from an old Mac to a new one. Keychain login data and keychain passwords can be copied from one Mac to another Mac manually this way, if need be.

Aimed at advanced users, this article will focus on transferring all passwords and login information you have stored on one Mac to another Mac, effectively transferring all crucial login data that is handled by Keychain.

How to Transfer Keychain Data Between Macs

  1. From the Mac OS X Finder of the Mac containing the original keychain file, hit Command+Shift+G to bring up Go To Folder and enter the following path:
  2. ~/Library/Keychains/

  3. Copy the user “login.keychain” file to the new Mac, do this with AirDrop, Ethernet, USB, etc
  4. On the new Mac, hit Command+Spacebar to open Spotlight and type “Keychain Access” then hit return, this launches the Keychain manager app
  5. Pull down the “File” menu and select “Add Keychain” and browse to the keychain file you copied to the new Mac, selecting Add to import the stored keychain data to the new Mac

With the keychain data imported, all of the stored logins and passwords from the old Mac should be imported into the new Mac and ready to use. You can test it by going to a web page or app where password data is typically stored and verifying that it is automatically entered.

If you have problems with Mac OS X not remembering passwords after importing the old keychain, use the Repair feature in Keychain Access to get everything back to normal.

You can copy the keychain data from one Mac to another Mac using just about any method you want to transfer the data, whether that is AirDrop, a wired network connection with SMB or AFP sharing, ssh or scp, a USB flash drive or external hard drive, or any other similar data transfer mechanism.

If you are performing the keychain transfer from a Mac that can’t be booted, or if you want to copy keychain data from a backup of a hard drive, you could mount the drive separately, or find the keychain data in a relevant backup, and locate the keychain password file data directly by navigating to the following directory:

/users/USERNAME/Library/Keychains/

Changing USERNAME to the user name of the individual who owns the keychain file.

Mac Keychain Data Location

That same directory is actually where the keychain data is stored on all Macs with MacOS (macOS) or Mac OS X. Thus, the directory path and keychain data location on a Mac is at the following location:

/Users/USERNAME/Library/Keychains/

Replacing ‘USERNAME’ with the name of the user, for example username “Paul” would look like:

/Users/Paul/Library/Keychains/

This is from the root directory / but for an active user account you can use the ~ tilde shortcut for the user home directory a well:

~/Library/Keychains/

You can transfer and copy Keychain data from various computers this way by finding the keychain data files and copying them to other machines.

Keychain data location on Mac OS

Finally, if you used external media like a USB drive to transfer the keychain file, you will probably want to go manually delete that since it’s never a good idea to have login information floating around, particularly on any unencrypted drive or volume.

.

Related articles:

Posted by: William Pearson in Mac OS, Tips & Tricks

21 Comments

» Comments RSS Feed

  1. Oj says:

    This method no longer works with Mojave.
    That is, copy keychain files from High Sierra system to Mojave system did not work for me. None of passwords are transferred over.

    • tron says:

      This only works with locally stored keychain items to transfer passwords. If you use iCloud Keychain then this will not work as there are no locally saved password data, it is encrypted in iCloud instead.

      However, iCloud Keychain will sync all keychain passwords between Macs using the same Apple ID, so you can try that instead to gain the same copying effect of passwords and logins.

  2. Fred says:

    > What do you mean when you say “ser” here?
    > Copy the ser “login.keychain” file to the new Mac, do this with AirDrop,

    I think this is a typo, its meant to be “user”, as in “Copy the user “login.keychain” file…”

  3. Mike says:

    What do you mean when you say “ser” here?

    Copy the ser “login.keychain” file to the new Mac, do this with AirDrop,

    Thank you.

  4. Mr. Mac says:

    needless to mention, that the above instruction were great & totally useful in 2012 i.e. when they were written, but unfortunately they do not apply anymore to Mac OS X versions 10.11 (El Flappy Tan) and probably later :(

    • Pablo says:

      Actually this works fine in OS X 10.11.4 El Capitan. Keychains are still stored in ~/Library/Keychains/

      You can also use iCloud Keychain now to sync a keychain between Macs, which is easier for most users, but it requires iCloud of course. Syncs to iOS devices as well.

  5. Ball says:

    Do NOT follow these instructions unless you want everything added.

    Now I have to figure out how to undo this f-ing mess!

    • bbq2nite says:

      Did you not read the article? Of course it copies “everything”.

      Yes you’re copying the keychain logins and passwords, both plural, to another Mac.

      That is the entire point. If you want to selectively copy a single password or login, you would need to export it, but why do that when you can just login on the new Mac? The whole point of this is to ease the transition by copying every login.

  6. Russ says:

    I just did a clean install on my ’11 MBP. I did things the old fashion way and manually copied the files/folders/etc. that I wanted to keep. I copied the entire KeyChain folder from Mac1. When I go to import the “login.keychain” and click “add”, the box disappears but nothing gets imported… the app is Unlocked. Is there anything I am missing or need todo? Much Thanks

  7. GT says:

    Does anyone have any idea how I can recover my keychain from backup? My hard disk had to be replaced and my backup isn’t showing Keychains in the backup when I type the path ‘~/Library/Keychains/’ – only brings up the Keychain on the new hard drive.

    In fact, my backup doesn’t show a Library folder at all in the same location as it appears on the new hard drive.

    Help would be really appreciated – too many Safari passwords to remember/replace otherwise.

    Cheers

    • ptuhan says:

      Restore your Mac from the Time Machine backup and Keychain would go with it to the new Hard Drive. The contents of Time Machine volumes are not meant to be user accessible beyond Time Machine, the ~/Library/Keychains/ folder is your root hard drives personal user home library, that’s why you aren’t seeing the backup there.

  8. Jes says:

    Thanks for this information!!!
    Attempted to delete an imported keychain and could not find the Library folder under my user path. Went to view – show view options – clicked on show Library folder as it was by default hidden.

  9. Marco says:

    Here is a solution to sync keychains between macs. Called Keychain2Go http://www.jinx.de/Keychain2Go.html

    • Christopher says:

      LIFESAVER! What a great App! Transferred all my UN/PW info saved from older 2010 MacBook Pro to my new SSD MacBook Pro within seconds. Migration Assistant wasn’t really an option for me because there were tons of stuff I really didn’t want to transfer and clutter up drive space. I’ve been transferring only files and programs needed. Time Machine back up was also WAY TOO big and again, trying to avoid clutter of files I hadn’t opened in a long time. This App is awesome!

  10. vna says:

    If you are starting with a brand new Mac I would highly recommend Migration Assistant, it’s hands off and flawless.

    • EjK says:

      I total agree with vna. I had to sell my old mac before my new one came. At the last minute I did a backup using time machine and wiped my old mac and shipped it off. Days later when my new mac came I restored using Migration Assistant with my time machine backup and it was like I never left. Flawless. Try doing that with a PC. Not happening.

      • Eric says:

        Sometimes Migration Assistant is not an option, especially when jumping several revs of the OS, like say going from Tiger to Mountain Lion. This is helpful information. Trust me on this.

        • Johannes says:

          I agree also you get plenty free space and leave all other system issues behind.
          I just downgraded from 10.10(buggy and losing support for drag and drop in many places) to 10.9 and now I have issues here and there.

          I will probably reformat transferring “Application Support” selected files from “Preferences”, “Keychains”, “QuickLook” and “PreferencePanes” Library folders.
          Then you get only what you need and a bunch of space :).

          I’v been doing this since Tiger and it keeps your system as fast as out of the box.

          Some apps that fill your system with burdens like Adobe’s will need to be reinstalled though.

          • Kim says:

            Hi, I’m setting my mac book pro back to factory settings as it has 196GB in ‘Other’ under storage, and no matter how many files I delete the other goes no where. A nice guy at apple suggested returning to factory settings as it will then remove the layers that apparently build up when you update OSs, my macbook pro is 2009, so lots of updates in it’s time.

            I’ve backed up all my personal files and iTunes, iPhoto libraries but now getting a bit confused as to which others to backup and restore to the computer. I’m going to pinch your list above but would you recommend any others?

            Obviously I can’t use migration as it would take all the crap with it i’m trying to leave behind.

            Any suggestions welcome

            Thanks

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site