Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Restore Keychain on Mac

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Restoring your Mac's keychain brings back saved passwords, Wi-Fi credentials, and other secure data from a backup. You can do this using Time Machine, a manual backup of the keychain folder, or by resetting the keychain if you don't have a backup. This guide walks you through each method, plus what to do when things go wrong.

What You'll Need

  • Your Mac's admin username and password
  • If restoring from Time Machine: the Time Machine backup drive or a local snapshot
  • If restoring manually: a copy of the ~/Library/Keychains folder from before the issue
  • Your Apple ID password (for iCloud Keychain re-sync, if you use it)

Step-by-Step

Method 1: Restore from Time Machine

  1. Close all apps that might be using the keychain (especially Safari and Mail).
  2. Open Time Machine from the menu bar (the clock icon) or from System Settings > General > Time Machine.
  3. Click "Enter Time Machine" or use the Time Machine icon in the menu bar.
  4. Use the timeline on the right edge to go back to a date before the keychain issue occurred.
  5. Navigate to . If you don't see the Library folder, press Command+Shift+. (period) to show hidden files.
  6. Select the keychain files or the entire Keychains folder, then click "Restore" at the bottom right.
  7. If prompted, enter your admin password. Time Machine will copy the files back to their original location.
  8. Restart your Mac. When you log in, the Keychain Access app should show your restored items.

Method 2: Restore from a Manual Backup

  1. If you have a copy of the ~/Library/Keychains folder (for example, from an external drive or cloud backup), first quit all apps that use keychain.
  2. Open Finder, press Command+Shift+G, and type ~/Library/Keychains, then press Enter.
  3. Rename the current Keychains folder to Keychains_old (right-click > Rename). This keeps a fallback if something goes wrong.
  4. Copy your backup Keychains folder into the same location (~/Library/).
  5. Restart your Mac and log in. Test with a known password (like a Wi-Fi network) to confirm it works.

Method 3: Reset Keychain (No Backup)

  1. Open Keychain Access (in Applications > Utilities).
  2. In the menu bar, go to Keychain Access > Settings (or Preferences in older macOS).
  3. Click the "Reset My Default Keychain" button. You'll be asked for your login password.
  4. Confirm the reset. This deletes the current login keychain and creates a new, empty one.
  5. Restart your Mac. You'll need to re-enter passwords for Wi-Fi, websites, and apps as you use them.

Note: Menu names and button labels can vary slightly depending on your macOS version and region. If you can't find a specific label, look for the equivalent option in the app's settings.

Common Mistakes

  • Restoring while logged in: If you restore keychain files while apps are actively using them, the restore may fail or corrupt the new files. Always quit apps first and, ideally, log out or restart after restoring.
  • Restoring the wrong folder: The keychain folder is ~/Library/Keychains (your user library), not /Library/Keychains (system-wide). Mixing them up will cause issues.
  • Overwriting without a backup: If you replace the current keychain folder without renaming it first, you lose any new passwords saved after the backup was made. Always keep the old folder until you're sure the restore worked.
  • Not updating iCloud Keychain: If you use iCloud Keychain, restoring an older local backup might conflict with iCloud's version. After restoring, go to System Settings > Apple ID > iCloud > Passwords & Keychain and toggle it off and on to force a re-sync.

Tips

  • Back up regularly: Make a copy of ~/Library/Keychains whenever you do a major macOS update or before troubleshooting keychain issues.
  • Use iCloud Keychain: If you enable iCloud Keychain, your keychain is stored in iCloud and can be restored automatically on a new Mac or after a reinstall.
  • Keep your login password in mind: The login keychain is encrypted with your user password. If you change your user password, macOS usually updates the keychain automatically, but if not, you may need to enter your old password once.
  • Test with one item: After restoring, try to autofill a password in Safari or connect to a saved Wi-Fi network before assuming everything is fine.

Troubleshooting

If the restore doesn't go as planned, here's what to try in order:

  1. Restart your Mac. Keychain services often re-initialize on login, which can fix minor glitches.
  2. Check if the keychain is locked. Open Keychain Access, click on "login" in the left sidebar, and go to File > Lock Keychain, then File > Unlock Keychain. Enter your password.
  3. Verify the files are in the right place. In Finder, press Command+Shift+G and go to ~/Library/Keychains. You should see a folder named after your Mac (e.g., DCB7A2E9-...-A1B2C3) and a file called login.keychain-db.
  4. If you renamed the old folder, swap back. If the restored keychain doesn't work, delete the new folder and rename Keychains_old back to Keychains, then restart.
  5. If you used Time Machine and the restore didn't work, try restoring just the login.keychain-db file instead of the whole folder, as some metadata files can cause conflicts.
  6. If you reset the keychain and now can't save new passwords, open Keychain Access, check if the login keychain is selected as the default (File > Make "login" the Default Keychain).
  7. If nothing works, you can create a new user account temporarily to see if the keychain works there. If it does, the issue is with your user's keychain files, and you may need to reset and re-enter passwords manually.

Frequently Asked Questions

Will restoring my keychain affect my saved passwords in Safari?

Yes, that's the point. Restoring the keychain brings back the passwords that Safari saves, so they should autofill again after the restore.

Can I restore a keychain from a different Mac?

Technically yes, if you have the ~/Library/Keychains folder from that Mac, but it may not work if the user account names differ. It's safer to use iCloud Keychain or migrate with Migration Assistant.

What happens if I forget my login keychain password?

If you don't know the password for the keychain, you can't unlock it. You can reset the keychain (which deletes all saved passwords) using the method above, but you'll lose the data. If you use iCloud Keychain, you can sign in with your Apple ID to recover it.

Does restoring from Time Machine also restore iCloud Keychain?

No. Time Machine restores local keychain files only. iCloud Keychain is synced separately from Apple's servers. After a Time Machine restore, you may need to sign in to iCloud again to re-sync.

Why does my Mac keep asking for the keychain password after restore?

This usually happens if the keychain's password no longer matches your login password. Go to Keychain Access > Edit > Change Password for Keychain "login" and enter your old and new passwords to sync them.

Is it safe to delete the old keychain folder after a successful restore?

Yes, once you've confirmed that all your passwords work and you've restarted without issues, you can delete the Keychains_old folder to free up space. But keep it for a few days just in case.