Show the Current Wi-Fi Network Name

networksetup -getairportnetwork prints the SSID the Wi-Fi interface is associated with, right now.

macOSnetworknetworksetupWi-FiLow risk
Run `networksetup -getairportnetwork en0` — it prints something like 'Current Wi-Fi Network: Home_5G'.

01Command

Command
$ networksetup -getairportnetwork en0

02What 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

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-18 · Category: System & Settings

06Related solutions