Where apps hide your files
macOS spreads keychain data across several files in your Library, in /Library and in /System. This lists each one, what it does, and the safe ways to back up or move what is inside.
~/Library/Keychains/login.keychain-db
That is the file most people mean. It is your login keychain: saved passwords, certificates, keys and secure notes, opened automatically when you log in. Open the folder with ⇧⌘G in Finder, or run open ~/Library/Keychains in Terminal.
To see which keychains your account uses, without reading anything inside them, run:
security list-keychains
On the Mac checked for this post (macOS Sequoia 15.6) it prints two paths: the login keychain above and /Library/Keychains/System.keychain.
| Path | What it is |
|---|---|
~/Library/Keychains/login.keychain-db | Your login keychain, the default for your account. |
~/Library/Keychains/metadata.keychain-db | A support file the security system keeps beside it. |
~/Library/Keychains/<UUID>/keychain-2.db | The newer keychain database behind iCloud Keychain and the Passwords app. The folder name is an ID. |
/Library/Keychains/System.keychain | Mac-wide items shared by all users, such as saved Wi-Fi networks and system certificates. |
/Library/Keychains/system-keychain-2.db | The system's newer database, readable only by root. |
/System/Library/Keychains/SystemRootCertificates.keychain | Apple's built-in trusted root certificates. Read-only. |
On the Mac checked here, ~/Library/Keychains held login.keychain-db, metadata.keychain-db, two UUID-named folders and a certificate store left by Microsoft software. Yours will differ with the apps you use.
The -db ending arrived with macOS Sierra. Before that the file was login.keychain, and old backups may still use that name.
You may also see files such as login.keychain-db.sb-52e0b571-CAPDYc. They are working copies the keychain service leaves while saving, and the files ending in -shm and -wal inside the UUID folders belong to the database there. Apple does not document either, so leave them alone.
A keychain file is encrypted, and the login keychain is tied to your Mac login password. A plain copy to another Mac is not a dependable way to move it, and the iCloud Keychain database in the UUID folders is not meant to be moved by hand at all. Never email, upload or share these files: anyone who has the file and your login password can try to open it.
Do not delete, rename or edit any keychain file in Finder or Terminal. Deleting login.keychain-db throws away every password, key and certificate stored only there, and apps start asking for passwords you may no longer have.
You usually want one of three outcomes, and each has an Apple route.
For certificates and private keys, use Keychain Access. On Sequoia it lives in /System/Library/CoreServices/Applications/, not in Utilities, but Spotlight opens it by name. Select the items and choose File > Export Items, then pick a format. A private key is exported in a password-protected file, so choose that password carefully.
Time Machine backs up ~/Library/Keychains with the rest of your home folder, which is how you restore the same Mac after a mistake.
Make sure you can get back what the keychain holds:
After the install, sign in to the same Apple Account and synced items return. Items that were never synced do not. If you use Time Machine or Migration Assistant instead, the login keychain comes back only when you restore the whole user account, not just your Documents folder.
If Keychain Access keeps asking for a password that no longer works, usually after a password reset, the login keychain is probably still locked with your old password. Typing the old one, if you remember it, opens it and lets you carry on. If not, Keychain Access has a reset: choose Keychain Access > Settings and click Reset Default Keychains. That gives you a new, empty login keychain, so try every other route first and expect to sign in to apps and websites again.
To check whether a single password exists, search for it by name in the Passwords app or Keychain Access. Never try to read the keychain files themselves.
Spotlight does not list anything inside ~/Library, so searching "keychain" in Finder returns nothing useful. Everywhere includes those folders, so typing keychain-db shows your login and metadata files, and keychain-2.db shows the database inside each UUID folder, which is handy for confirming what exists before a clean install. ⌘↵ reveals a result in Finder. It only knows file names: it cannot open or read a keychain, and neither should anything else.
Your login keychain is ~/Library/Keychains/login.keychain-db. Mac-wide items, such as saved Wi-Fi networks, live in /Library/Keychains/System.keychain.
Not as a dependable method. The file is encrypted and tied to your login password, and iCloud Keychain data sits in separate files. Use iCloud Keychain or Migration Assistant instead.
The login keychain is the older file-based store for your account. The keychain-2.db file in a UUID-named folder is the newer database used by iCloud Keychain and the Passwords app.
No. Deleting one throws away the passwords and certificates stored only in it. Remove individual items in the Passwords app or Keychain Access instead.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised