MainspringGuides › Wi-Fi password
macOS Guide

Find a Saved Wi-Fi Password From Terminal on Mac

Updated July 2026 · 3 min read

Someone asks for the Wi-Fi password, and nobody remembers it — but your Mac does. Every network you've ever joined is stored in the system keychain, and one Terminal command reads a password back out. You'll need to prove you're an administrator first, which is exactly as it should be.

The Terminal command

# print the saved password for a network (use its exact name)
security find-generic-password -wa "HomeNetwork"

Two things happen. First, a dialog appears saying Terminal wants to use your confidential information stored in the keychain — type an administrator username and password (your macOS login, not the Wi-Fi password) and click Allow. Then the Wi-Fi password prints in Terminal, alone on its own line, ready to copy.

The flags: -a matches the account/item name — for Wi-Fi entries that's the network name (SSID) — and -w prints only the password instead of the full keychain record. The network name must match exactly, including capitalization and spaces. If you get could not be found in the keychain, check the spelling against the list of networks your Mac actually remembers: networksetup -listpreferredwirelessnetworks en0.

This is a read-only lookup — it changes nothing, so there's nothing to undo. Clicking Always Allow in the dialog, though, permanently lets Terminal read that item without asking again; prefer plain Allow so each future read still requires consent.

The GUI routes

Where passwords live in the interface depends on your macOS version:

  1. macOS Sequoia: open the Passwords app, unlock with Touch ID, and click Wi-Fi in the sidebar — every saved network, with a Show Password option.
  2. macOS Sonoma: go to System Settings → Wi-Fi, scroll to a known network, click the button beside it, and choose Copy Password. Networks not in range live under Advanced.
  3. macOS Ventura (and any version): open Keychain Access (Applications → Utilities), search for the network name, double-click the entry, and tick Show password. Authenticate when asked.

All of these end in the same admin authentication as the Terminal route — the interface varies, the security boundary doesn't.

Why your Mac makes you authenticate

Wi-Fi passwords are stored in the system keychain, encrypted on disk, and treated like any other credential. If reading them were free, any process or passer-by at an unlocked Mac could harvest every network you've ever joined — hotel, office, home — and network passwords are reused depressingly often. The admin prompt is the whole defense, which leads to three practical notes:

A privacy-minded refinement: pipe the output straight to the clipboard instead of the screen —

# fetch the password without displaying it
security find-generic-password -wa "HomeNetwork" | pbcopy

The same authentication dialog appears, but the password lands in your clipboard rather than on a projector or over someone's shoulder. Paste it where it's needed, then copy something else so it doesn't linger — the clipboard has no history on a stock Mac, but it also has no expiry.

Secrets guarded. Settings surfaced.

macOS hides passwords for good reasons — and hides plenty of harmless settings for no reason at all. Mainspring surfaces 90+ of them as labelled, reversible toggles.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

Sharing it the easy way

If the person is standing next to you with an Apple device, macOS can share the network without ever showing the password — see our guide to sharing a Wi-Fi password from your Mac.