Have you ever encountered a situation where you need to connect a new device to Wi-Fi, but you have long forgotten the password, and MacBook automatically connects to the network? Or do you need to grant access to a guest, but you no longer have the piece of paper with the code? macOS All wireless network passwords are securely stored in the system vault. Keychain - but how to get them out of there?
This article will not only show you, Where are the Wi-Fi password files physically located in macOS (the path `/Library/Keychains/System.keychain` and user keychains), but will also give 5 working ways to extract them - from standard tools to hidden commands TerminalWe'll also discuss how to securely export passwords for backup and why you should never store them in plaintext.
Important: the methods work on all current versions of the system - from Monterey 12 to Sonoma 14, but the interface may differ slightly. If you are using Mac At work, ensure that company security policies allow access to system keys.
1. Where macOS stores Wi-Fi passwords: Storage architecture
Unlike Windows, where network passwords can be found in the registry, macOS uses secure storage Keychain Access (or simply Keychain). This is not a single file, but an entire system of encrypted containers that stores:
- 🔑 Wi-Fi network passwords (
AirPort network password) - 🌐 Logins/passwords for websites and applications
- 🔒 Certificates and cryptographic keys
- 📱 Autofill data in Safari
Physically, the keys are stored in several files:
| Key type | File path | What does it store? |
|---|---|---|
| Systemic | /Library/Keychains/System.keychain |
General network settings, Apple certificates |
| Custom | ~/Library/Keychains/login.keychain-db |
Personal passwords, including Wi-Fi |
| Local | /Library/Keychains/System.keychain |
Data for general profiles (e.g. in the office) |
| iCloud | Syncs with the cloud | Passwords if enabled Keychain in iCloud |
Each file is encrypted with a unique key linked to the user's account. Access to them is controlled by the system. Security Framework, so simply opening the file in a text editor won't work—you'll need special software or commands.
2. Method 1: View your password via Keychain Access
The easiest and safest method is to use the built-in utility Keychain AccessIt's included in every macOS and doesn't require administrator rights to view. own passwords.
Instructions:
- Open
Spotlight(⌘ + Space) and type "Keychain Access" (Keychain Access). - In the left column, select
login(your user link) and categoryPasswords. - In the search bar, enter the name of your Wi-Fi network.
- Double click on the found entry of the type
AirPort network password. - Check the box "Show password" and enter your password Mac-account.
If the password is not displayed or the entry is missing, check:
- 🔄 Is the network name spelled correctly (case is important!)
- 📡 Have you connected to this network from this Mac previously
- 🔒 Is your security policy blocking access (on work computers)?
Check the network name is correct|Make sure you are looking for "login" in the keychain|Try another method (Terminal)|Restart your Mac if Keychain is frozen-->
⚠️ Attention: If you are using a corporate Mac with control through MDM (For example, Jamf or Kandji), the administrator may have disabled access to viewing passwords. In this case, please contact your IT department.
3. Method 2: Extracting the password via Terminal (security command)
For advanced users, there is a faster method - using the command security V TerminalThis method allows you to get a password in one line without a graphical interface.
Open Terminal (through Spotlight or /Applications/Utilities/) and run:
security find-generic-password -wa "YOUR_NETWORK_NAME"
Replace YOUR NETWORK NAME The exact Wi-Fi name (case-sensitive!) will be entered. The system will ask for your account password. Enter it, and the network password will be displayed in the terminal.
If you want to find all saved networks, first run:
security dump-keychain -d login.keychain | grep "AirPort"
This command will list all Wi-Fi networks you've ever connected to. Then use the first command for a specific network.
4. Method 3: Export all Wi-Fi passwords to a file (for backup)
If you need to save all Wi-Fi passwords for backup (for example, before resetting Mac or moving), they can be exported to an encrypted file. To do this:
- Open
Keychain Accessand select a categoryPasswords. - In the search bar, enter
AirPort— all saved networks will be displayed. - Select the desired entries (you can select several by holding down ⌘).
- Right click →
Export elements.... - Select format
.keychain(encrypted) or.plist(less safe). - Specify a password for the exported file (do not use your Wi-Fi password!).
The file can be imported back via Keychain Access → File → Import ItemsFor safety:
- 🔐 Store the exported file in an encrypted container (e.g. VeraCrypt)
- 📁 Don't send it by email or instant messenger in clear text
- 🗑️ Delete the file after use if you no longer need it
⚠️ Attention: Exported file.plistcan be opened in a text editor, and passwords will be visible in unencrypted form. Always use the format.keychainwith a strong password.
5. Method 4: Using third-party utilities (WiFi Password Viewer, Keychain Dumper)
If standard methods don't work (for example, due to security policy restrictions), you can use third-party programs. They often offer additional features, such as:
- 📋 Bulk export all passwords to
CSV - 🔍 Search by last connection date
- 📊 Network usage statistics
Popular utilities:
| Program | Link | Peculiarities |
|---|---|---|
| WiFi Password Viewer | Mac App Store | Simple interface, free |
| Keychain Dumper | GitHub (open source) | For advanced users, works via Terminal |
| Secrets | Official website | Paid, with support iCloud Keychain |
Warning: Download software only from official sources (Mac App Store or developer repositories). Some "hacked" utilities may contain malicious code to steal all passwords from Keychain.
How to check a utility for security?
Before installation, check:
1. Reviews in the Mac App Store (if any).
2. Date of the last update (current software is updated at least once a year).
3. The rights that the program requests (it should not require access to contacts or location).
4. Availability of open source code on GitHub (you can check this yourself or through services like VirusTotal).
6. Method 5: Recovering the password via Time Machine (if the password has been changed)
If your Wi-Fi password has recently changed and you have connected to the network to this change, it can be restored from a backup Time MachineTo do this:
- Connect the disk with the backup copy.
- Open
Keychain Access. - In the menu, select
File → Restore Keychain from Time Machine Backup. - Find a date when you were still connected to the network with the old password.
- Restore the connection
login.keychain.
After recovery, the old password will appear in KeychainPlease note that:
- ⏳ This will only work if a backup has been created to change password.
- 🔄 Restoring the password pair will overwrite your current passwords (export before doing this!).
- 📅 Time Machine must be configured to perform regular backups.
7. Security: How to Protect Wi-Fi Passwords on macOS
Now that you know how to extract passwords, it's important to ensure they're secure. Here are some key security measures:
- 🔐 Use a strong password for your account Mac (this is the same password from Keychain!).
- 🛡️ Turn on
FileVault(disk encryption) inSystem Preferences → Security & Privacy. - 🚫 Disable automatic login (otherwise, anyone with physical access will be able to see your passwords).
- 🔄 Update macOS regularly (Apple patches vulnerabilities in Keychain).
If you suspect someone has gained access to your passwords:
- Change your Wi-Fi password through your router immediately.
- Check it out Keychain for suspicious entries (e.g. unknown networks).
- Reset your account password Mac (this will reset access to Keychain).
⚠️ Attention: On macOS Sonoma 14.4+ Apple has tightened access to system keys. Some commands Terminal may require explicit confirmation through Touch ID or password, even if you are an administrator.
FAQ: Frequently Asked Questions About Wi-Fi Passwords on macOS
Is it possible to see the Wi-Fi password that another user is connected to on this Mac?
No. Each user has their own keychain (login.keychain). Passwords from other people's accounts are inaccessible without administrator rights and knowledge of their password. The exception is if the password is stored in systemic bundle (System.keychain), but this is rare for home networks.
Why the team security Terminal gives the error "Could not find password"?
Possible reasons:
- Typo in network name (check case!).
- The password is stored in iCloud Keychain, and not locally.
- The network was removed from the keychain (for example, after resetting network settings).
- You are searching in the wrong connection (try
security dump-keychain -d system.keychain).
How to transfer Wi-Fi passwords to a new Mac?
There are three ways:
- Via iCloud Keychain: Turn on sync on both devices (
System Preferences → Apple ID → iCloud → Keychain). - Export/import: Export
.keychain-file from the old one Mac and import to a new one. - Migration: When you first start a new one Mac select transfer data from old via Migration Assistant.
The most reliable method is iCloud Keychain, as it automatically updates passwords on all devices.
Is it possible to find out the Wi-Fi password that my Mac was connected to but is now out of range?
Yes, passwords are stored in Keychain regardless of whether the network is currently available. Use any of the methods described (for example, searching through Keychain Access or a team security find-generic-password -wa "NETWORK_NAME").
What should I do if macOS asks for my Keychain password, but I don't remember it?
Password from Keychain by default it matches your account password MacIf you changed it:
- Reboot Mac V Recovery mode (⌘ + R when loading).
- Open
Terminalfrom the utilities menu. - Enter
resetpasswordand follow the instructions to reset your account password (this will also reset your password Keychain).
⚠️ After the reset, all saved passwords (including Wi-Fi) will remain, but you will need a new password to access them.