Show the Current Wi-Fi Network Name
networksetup -getairportnetwork prints the SSID the Wi-Fi interface is associated with, right now.
Run `networksetup -getairportnetwork en0` — it prints something like 'Current Wi-Fi Network: Home_5G'.
01Command
Command
$ networksetup -getairportnetwork en002What it does
The menu bar hides the network name once you remove the Wi-Fi icon, and it never shows hidden SSIDs at all. This command reads the association straight from the wireless interface, so it works for hidden networks and is handy in scripts that behave differently per network, for example switching default printers at the office. If the output says the Mac is 'not associated', Wi-Fi is on but not connected to any network.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- networksetup — network configuration tool (macOS man page)Evidence: Documents -getairportnetwork <device>, which prints the SSID of the currently associated wireless network.
Last verified: 2026-09-18 · Category: System & Settings