TL;DR What's the replacement via CLI, programmatically, &| reliable AppleScript-fu.
Scenario
Auto-switching between Ethernet adapters (i.e., built-in MAC official/unofficial Ethernet adapters, third-party 10 GbE USB-C), and Wi-Fi.
Problem
Standard operation in post-Network Location macOS leads to assigning multiple IP addresses, causing havoc with applications and network services. Disabling Wi-Fi manually is non-starter.
Goal
Disassociate from Wi-Fi programmatically or from the CLI without powering off Wi-Fi to retain Wi-Fi PAN services such as AirDrop and AirPlay.
(Previous) Solution
Calls airport -z
when needed to disassociate. Re-associate with other magic tools when Ethernet becomes unreachable. It worked reliably for over a year.
Invocation
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
Expected (previous) behavior
Wi-Fi disassociates but remains powered on
Actual behavior
- Output
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.
- (nothing happens)
Platform
14.4 (23E214) m1/arm64
Here's the script and LaunchDaemon I wrote and was using.