Keychain is the encrypted credential store built into macOS that holds passwords, cryptographic keys, certificates and secure notes for the user and the system, and releases each item only to authorized apps and processes. In macOS security & privacy, it is the central place where apps keep secrets instead of writing them to their own files, and users manage it through the Keychain Access app or the newer Passwords app.
Keychain lets macOS fill in Wi-Fi passwords, website logins, mail accounts and VPN credentials without asking the user each time, while keeping those secrets encrypted at rest and tied to the user’s login.
How Keychain stores and protects secrets
Keychain stores each secret as an item with attributes and encrypted data. The attributes, such as account name, server and label, help apps find the item, while the secret itself stays encrypted with keys derived from the user’s login password and, on modern Macs, protected by the Secure Enclave.
| Item type | Contents | Typical user |
|---|---|---|
| Internet password | Website or server credentials with protocol and host | Safari, Mail, network clients |
| Generic password | Any secret an app stores under a service name | Third-party apps, Wi-Fi networks |
| Certificate | Public certificate, often a trusted root or client identity | TLS, VPN, code signing |
| Key | Private, public or symmetric cryptographic key | Signing and encryption |
| Secure note | Free text stored encrypted | Users storing short secrets |
Access is controlled per item. When an app requests an item it did not create, macOS shows a prompt where the user can allow once, always allow or deny. Choosing always allow adds the app to the item’s access control list, which is why careless approval of prompts weakens the model.
Keychains on a Mac and where they live
A Mac holds several keychains with different owners and lifetimes. Knowing which keychain holds an item explains many troubleshooting cases.
| Keychain | Scope | Unlocked by |
|---|---|---|
| Login keychain | Per-user secrets in a file-based keychain | The user’s login password |
| Local Items or iCloud keychain | Data protection keychain, optionally synced | Login and device keys |
| System keychain | Machine-wide items such as Wi-Fi for all users | Administrator authorization |
| System Roots | Trusted root certificates shipped with macOS | Read-only, managed by Apple |
The login keychain file sits in the user’s ~/Library/Keychains folder, while the data protection keychain is managed by the system and uses access groups and app entitlements rather than per-item lists. Apps built for current macOS versions are expected to use the data protection keychain, which follows the same model as iPhone and iPad.
Keychain compared with related macOS features
Keychain is often confused with iCloud Keychain and with disk encryption. The features complement each other but protect different things.
| Feature | What it protects | Relationship to Keychain |
|---|---|---|
| Keychain | Individual secrets on the Mac | The local store itself |
| iCloud Keychain | Selected secrets across Apple devices | End-to-end encrypted sync of the data protection keychain |
| Passwords app | User-facing view of passwords and passkeys | Front end for keychain data |
| FileVault | The whole startup disk | Protects keychain files when the Mac is off |
| Secure Enclave | Hardware keys | Guards the keys that protect keychain items |
Since macOS Sequoia, the Passwords app is the everyday tool for website passwords and passkeys, and Keychain Access has moved to the system utilities folder. Keychain Access remains the tool for certificates, keys and system keychain items.
Administration from the command line
Administrators and developers manage keychains with the built-in security command-line tool. It is essential for automation, build servers and scripts that need credentials without storing them in plain text.
security find-generic-password -s service -wreturns a stored secret to a script, triggering an access prompt if needed.security add-generic-passwordcreates an item, and the-Toption lists trusted applications for its access control list.security list-keychainsandsecurity unlock-keychainmanage the keychain search list on build machines.security add-trusted-certinstalls a certificate with specific trust settings, often handled by device management profiles instead.
In managed fleets, certificates and Wi-Fi credentials are usually deployed through configuration profiles from an MDM server, which place items in the correct keychain without user interaction.
Common problems and pitfalls
The most frequent issue is a keychain password mismatch after an administrator resets a user’s login password. The old login keychain stays locked with the previous password, so macOS repeatedly asks for it until the user enters the old password or creates a new login keychain and loses the stored items.
| Symptom | Likely cause | Fix |
|---|---|---|
| Repeated login keychain prompts | Keychain password differs from new login password | Enter the old password or reset the keychain |
| App asks for access after every update | New app signature not in the access list | Approve once or reinstall a properly signed version |
| Certificate shown as not trusted | Missing intermediate or trust setting | Install the chain and review trust settings |
| Passwords missing on another device | Item stored in the local login keychain | Save it again in the synced keychain |
Other pitfalls include granting always allow to unknown apps, exporting identities with weak export passwords, and deleting the login keychain while troubleshooting without a backup. Malware that targets macOS often tries to trick users into approving keychain prompts, so an unexpected request deserves scrutiny.
A plain-language summary
Keychain is the Mac’s built-in safe for passwords and digital keys. When a user saves a Wi-Fi password or a website login, the Mac puts it in this safe.
The safe opens with the user’s login password. Apps must ask before taking anything out, and the Mac shows a prompt when an app wants something it did not put there. That way secrets stay locked away from other apps and from anyone without the password.
An example from practice
A mobile development team runs automated builds on a dedicated Mac mini. Each build must sign the app with a code signing identity, a certificate and private key, and upload it using an API key that must never appear in the build scripts.
The engineer creates a separate build keychain, imports the signing identity into it and stores the API key as a generic password with the security tool, listing only the code signing and upload tools as trusted applications. The build script unlocks this keychain at the start of each job and locks it again at the end.
Builds now run unattended without secrets in the repository. When a contractor leaves, the team rotates the API key in one place, and a stolen copy of the scripts reveals no credentials at all.