DEV Community

Brisbane Web Developer
Brisbane Web Developer

Posted on • Edited on

Amend Location Changer not working with macOS 14.4

Summary

Location Changer to automatically activate the network interface depending on the current Wi-Fi network, stopped working.

Solution

Revise the way to extract the current Wi-Fi network :

/usr/local/bin/locationchanger
======
# SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep ' SSID' | cut -d : -f 2- | sed 's/^[ ]*//'`
SSID=`networksetup -listallhardwareports | awk '/Wi-Fi/{getline; print $2}' | xargs networksetup -getairportnetwork | sed 's/[^:]*: //'`
Enter fullscreen mode Exit fullscreen mode

Reference

Top comments (0)