Excute "airport -s" failed on mac os 14.4

It was possible to excute:

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s on previous mac os version to get all SSID list.

But now on mac os 14.4 it returns like:

WARNING: The airport command line tool is deprecated and will be removed in a future release. For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.

Is there any other way to list all SSIDs? It's important to me since my code depends on this feature.

P.S. Seems other airport command like "airport -I" didn't work too. Is there any other tool could replace airport?

My code also depended on this tool.

I can say that the airport binary from macOS 14.3.1 does currently work under macOS 14.4 if you keep a copy. However knowing Apple it will highly likely be blocked at some point. In the meantime does anyone have a genuine Apple download link for the macOS 14.3.1 copy of this?

Note: Apple will soon stop signing the macOS 14.3.1 installer so keeping the entire OS installer will not only be a huge file but will also cease to work.

As an alternative approach does anyone have a Python script that would provide the same functionality? That is list available SSIDs with their details such as name, channel and signal strength.

Is there any other way to list all SSIDs?

Yes. Check out the scanForNetworks(withName:) method.

IMPORTANT Modern versions of macOS will only return useful results if the caller has the System Settings > Privacy & Security > Location privilege. See this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I wrote a script and everything worked will when run by python.

import objc
from CoreLocation import CLLocationManager
import logging

location_manager = CLLocationManager.alloc().init()
location_manager.requestWhenInUseAuthorization()

logger = logging.getLogger()
logger.setLevel(logging.INFO)

fh = logging.FileHandler('/Users/xpeng/Downloads/logging.log')
fh.setLevel(logging.DEBUG)


ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
ch.setFormatter(formatter)

logger.addHandler(fh)
logger.addHandler(ch)

if __name__ == '__main__':
    bundle_path = '/System/Library/Frameworks/CoreWLAN.framework'
    objc.loadBundle('CoreWLAN',
                    bundle_path=bundle_path,
                    module_globals=globals())
    iface = CWInterface.interface()
    logger.info(str(iface.interfaceName()))
    logger.info(iface.ssid())
    networks, error = iface.scanForNetworksWithSSID_error_(None, None)
    for network in networks:
        logger.info(network.ssid())

But after I pyinstaller -w -F test.py and excute sudo open path_to_app, the log was like

2024-03-13 18:10:51,931 - root - INFO - en1
2024-03-13 18:10:51,935 - root - INFO - None
2024-03-13 18:10:53,546 - root - INFO - None
2024-03-13 18:10:53,547 - root - INFO - None
2024-03-13 18:10:53,547 - root - INFO - None
2024-03-13 18:10:53,547 - root - INFO - None
2024-03-13 18:10:53,547 - root - INFO - None
2024-03-13 18:10:53,547 - root - INFO - None
2024-03-13 18:10:53,547 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,548 - root - INFO - None
2024-03-13 18:10:53,549 - root - INFO - None
2024-03-13 18:10:53,549 - root - INFO - None
2024-03-13 18:10:53,549 - root - INFO - None
2024-03-13 18:10:53,549 - root - INFO - None

I did grant test location permission in system preferences.

Is there any other thing must do before I pack?

Excute "airport -s" failed on mac os 14.4
 
 
Q