Sample Header Ad - 728x90

How to get active SSID in ZSH Script (MacOS Sequoia 15)

2 votes
0 answers
50 views
I have a script that used to fetch the name of my active wifi connection and, depending on which SSID is connected, it starts some services. But since I updated to MacOS 15, that stopped working.
networksetup -getairportnetwork en0
just returns You are not associated with an AirPort network. (but it clearly is connected). I also tried sudo wdutil info en0 as an alternative but this will just return SSID : (also it requires to run with elevated privileges, which I would like to avoid). I tried airport as an alternative, bat has been deprecated and stopped working all together a number of macOS updates ago. So, is there any way to get networksetup to return real values again? Or any other way to get the name of the active wifi connection in terminal / scripts (without installing additional software)?
Asked by Vincent (121 rep)
Oct 8, 2024, 08:47 AM