Alternative of airport command with latest os 14.4.1

Hi ,

We used to run this command to get wifi info on mac. /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I

but it seems with latest 14.4.1 , airport command has been deprecated and advised to use wdutil. The problem with wdutil is that it only works with sudo.

Is there a way we can still get all wifi metrics without sudo an mac?

For my use case, I require the following:

  1. Identify current WiFi network (SSID name)
  2. Connect to specific WiFi network (by SSID)
  3. Scan for nearby WiFi networks (SSID names)

I can work around issues 1 and 2 but have yet to find a commandline-capable workaround for issue 3.

Issue 1

/usr/sbin/networksetup -getairportnetwork en0 | grep 'Current Wi-Fi Network: ' | sed 's/Current Wi-Fi Network: //g'

Issue 2

networksetup -setairportnetwork en0 "<SSID>" "<PASSWORD>"

It seems that getting SSID names requires Location Service permissions, which apparently is not possible(??) with in-house commandline utilities (e.g. Python scripts) even when using libraries like pyobjc to request Location Services permissions via Objective-C hooks. This is a problem for my automation team.

We found some success by writing a tiny Swift app that requests Location Services permission and then does the scan but have not been able to get a commandline version of the app to work yet.

For the sake of developers who understand the risks, requesting that Apple allow manual addition of apps/scripts/binaries to have Location Services permissions so we can get back to work.

Apple System Profiler has a data type called 'SPAirPortDataType'.

`system_profiler SPAirPortDataType

Does this help?

Alternative of airport command with latest os 14.4.1
 
 
Q