Change Wi-FI Order

Maik
New Contributor II

Hey Everyone,

iam Looking for a way to change the Wi-fi Order on MacOS Ventura without Re-adding the Configuration.
I'm searching and found a lot of Scripts, but they will not work on Ventura.
In the past the information was saved here, but it isn't there anymore 

/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist"

It would nice to you if someone have a solution for that.

Thanks for your Support.

3 REPLIES 3

honestpuck
Contributor

@Maik Given that there is no information lost when you remove then add back a WiFi network using `network setup` I'm wondering why you are not doing that.

Here is some code that promotes a network to the top of the list :-

# discover device name of Wi-Fi network
WF=`networksetup -listnetworkserviceorder | grep "Wi-Fi," | sed "s#^([^:]*:[^:]*:\ \([a-z0-9]*\))#\1#"`

if [ "$DEBUG" == "True" ] ; then
    echo "Got WF: $WF"
fi

# promote Wi-Fi to top of service order
# build list of services
service_list=()
while read service; do
    service_list+=("$service")
done < <(networksetup -listnetworkserviceorder | grep "Hardware Port" | \
    grep -v "Wi-Fi" | sed 's#([^:]*:\ \([^,]*\),.*#\1#')
# do the promote
if [ "$DEBUG" == "True" ] ; then
    echo "Set order to: ${service_list[@]}"
fi
networksetup -ordernetworkservices Wi-Fi "${service_list[@]}"
if [ "$DEBUG" == "True" ] ; then
    echo "Order set"
fi

# promote MobileAnywhere to top of preferred WiFi networks
# note index starts at 0
networksetup -removepreferredwirelessnetwork $WF MobileAnywhere > /dev/null
networksetup -addpreferredwirelessnetworkatindex $WF MobileAnywhere 0 WPA2 > /dev/null
if [ "$DEBUG" == "True" ] ; then
    echo "MA promoted"
fi

You will notice that we don't need the password for the network to either remove it or add it back since this is in the Keychain.

The above code continues to work for me in Ventura as `networksetup` remains the same.

 

Maik
New Contributor II

Thank you i will try it with that.

Let me know how it goes.