How can we get the BSSID value for a wifi network without sudo

How can we get the BSSID value for a wifi network without sudo?


This command used to work earlier but its not giving the required data now.


ioreg -l -n AWDLPeerManager | perl -lne 'print $1 if $_ =~ /IO80211BSSID.*<(.*)>/;' | fold -w2 | paste -sd: -


Any idea what alternative command we could use to get network bssid value?

Posted on Aug 29, 2024 3:39 PM

Reply
19 replies

Aug 29, 2024 4:09 PM in response to anil_doc

anil_doc wrote:

How can we get the BSSID value for a wifi network without sudo?

This command used to work earlier but its not giving the required data now.

ioreg -l -n AWDLPeerManager | perl -lne 'print $1 if $_ =~ /IO80211BSSID.*<(.*)>/;' | fold -w2 | paste -sd: -

Any idea what alternative command we could use to get network bssid value?


I am unclear the circumstances here...


You can see the BSSID from the drop down menu Option click the WIFI icon


Sep 3, 2024 3:59 PM in response to anil_doc

Well, hopefully you do - I had a few minutes to play around on my Mac Mini running Sonoma over the weekend...on the newest macOS, wdutil requires sudo for the info command (which it did not used to), and even when run under sudo, there are pieces of info including SSID and BSSID that are redacted - literally, the info is replaced with the string "redacted".


Why Apple wants certain Wifi info that is literally broadcast over the air only accessible programmatically from NetworkKit and presumably using entitlements...no idea. But it seems that's the choice they have made.


Good luck with the dev forum.

Sep 3, 2024 6:11 PM in response to anil_doc

You’ll want to want to plan for the sudo requirement, even if you can get this to work now.


sudo wdutil info | grep "BSSID"


I don’t have macOS (specifically 14.5 Sonoma, or later) handy to check whether this still works, but this might still work:


networksetup -getairportnetwork en0 | awk -F ': ' '{print $2}'


This change is presumably happening because too many developers were using BSSID for tracking purposes or other shenanigans.


I’ve probably got some semi-recent Swift code around that pokes at this stuff too, but that code will likely require sudo or entitlements past 14.5. If that’s interesting, let me know and I’ll dig it up, dust it off, test it on macOS 13 latest (again, no macOS 14 is handy for testing), and post it here.

Aug 30, 2024 11:11 AM in response to anil_doc

It looks like wdutil ought to have replaced the airport tool - but I've never managed to get anything out of

wdutil info

even running sudo.


The fact that there are apps that provide Wifi info and control means there is obviously a way to do it - and if you can get the info without elevated permissions or entitlements, then the developers are the ones to ask.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can we get the BSSID value for a wifi network without sudo

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.