How to Export WiFi Passwords on Mac (Step-by-Step)

Ever needed to grab a WiFi password from your Mac to share with a friend or move to a new device? You’re in the right place. This guide is for anyone who’s ever connected to a network and then forgotten the password—or wants to keep a backup of all saved passwords. By the end, you’ll have a plain-text file containing every WiFi password your Mac has ever stored, ready to import or share. We’ll also touch on why you might want to do a wifi password recovery on macos the right way.


What You’ll Need


  • A Mac running macOS 10.10 or later (Yosemite and up)
  • Your Mac’s login password (the one you use to unlock your computer)
  • Terminal app (built-in, located in /Applications/Utilities/)
  • About 5 minutes of time


No additional software needed—everything is built right into macOS. If you’re more comfortable with a graphical interface, you can also use Keychain Access, but the Terminal method is faster for exporting everything at once.


Step 1: Open Terminal


Launch Terminal from Applications > Utilities, or search for it using Spotlight (Cmd+Space, type “Terminal”). This is where we’ll run a single command to dump all saved Wi‑Fi passwords.


export wifi passwords mac Terminal app icon on Mac dock Applications Utilities

Step 2: Run the Export Command


Copy and paste the following command into Terminal, then press Enter:


security find-generic-password -wa “Your Network Name”

Apple Developer Documentation


But wait—that only gets one network. To export all saved networks, we’ll use a one-liner that loops through every AirPort network:


security find-internet-password -s “AirPort” -g 2>&1 | grep -i “acct|password” | awk -F” ‘{print $4}’

Community Wisdom


Actually, that’s tricky. The easiest way is to use a shell script that lists all Wi‑Fi SSIDs and then fetches each password. But for most users, the simplest approach is to use the simplest wifi password recovery method: open Keychain Access and manually copy each one. However, if you want an automated export, use this script:


for ssid in $(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s | awk ‘{print $1}’ | tail -n +2); do security find-generic-password -wa “$ssid” 2>/dev/null && echo “Network: $ssid” || echo “$ssid: not found in keychain”; done

macOS Power Users


This will output each network name and its password (if stored). You can redirect the output to a text file by appending > ~/Desktop/WiFiPasswords.txt to the command.


export wifi passwords mac Terminal window showing security command output with WiFi passwords

Step 3: Review the Exported Passwords


After running the command, you’ll see a list like “Network: MyWiFi, password: mysecretpass”. If a network’s password isn’t stored in your login keychain, you’ll see a “not found” message. That’s normal—some networks may have been forgotten or never saved. If you need to recover wifi password from keychain for a specific network, you can also open Keychain Access, search for the SSID, and double-click to show the password.


export wifi passwords mac Keychain Access window showing Wi-Fi network password field

Step 4: Save the Output to a File (Optional)


To save the list permanently, run the command with the redirection:


for ssid in $(airport -s | awk ‘{print $1}’ | tail -n +2); do security find-generic-password -wa “$ssid” 2>/dev/null && echo “$ssid: $(security find-generic-password -wa “$ssid” 2>/dev/null)”; done > ~/Desktop/WiFi-Passwords.txt

macOS Terminal Tips


Now you have a plain-text file on your Desktop containing all your WiFi passwords. You can then backup wifi passwords to usb or import them into another device.


export wifi passwords mac Text file on Mac desktop named WiFi-Passwords.txt showing network names and passwords

Common Pitfalls


  • Keychain locked or permission denied. Make sure you’re logged in with an admin account and your keychain is unlocked. If Terminal asks for your password, enter your Mac login password.
  • SSID not found. The script above only lists networks currently visible via `airport -s`. For networks you’ve connected to but are out of range, use `networksetup -listpreferredwirelessnetworks en0` (replace en0 with your Wi-Fi interface name) to get a list of preferred networks.
  • Empty output or garbled characters. If you see no output or weird symbols, the password might contain special characters. Try enclosing the SSID in quotes in the `security` command. Also, some older macOS versions may require different flags.


For more troubleshooting, check out these wifi password recovery tricks that cover edge cases like iCloud Keychain sync or corrupted entries.


Where to Next


Now that you have your passwords exported, consider storing them securely (e.g., in a password manager) or moving them to a USB drive for safekeeping. If you’re setting up a new Mac, you can also use the exported list to quickly reconnect to all your old networks. For a deeper dive into managing network settings, read our guide on how to backup wifi passwords to usb. And if you ever need to recover a password on a different device, our simplest wifi password recovery article covers options for Windows, Android, and iOS.

Leave a Reply

Your email address will not be published. Required fields are marked *