Skip to content

Instantly share code, notes, and snippets.

@jeremy4971
Last active January 6, 2024 10:30
Show Gist options
  • Save jeremy4971/230b8cf40f5c706c60c0cbf1d8110b74 to your computer and use it in GitHub Desktop.
Save jeremy4971/230b8cf40f5c706c60c0cbf1d8110b74 to your computer and use it in GitHub Desktop.
#!/bin/sh
###
#
# Created : 2020-03-10
# Last Modified : 2022-10-09
# Version : 1.01
# Tested with : macOS 12.6
#
###
for interface in $(networksetup -listnetworkserviceorder | grep Hardware | awk '/Wi-Fi/ { print $NF }' | awk -F ")" '{ print $1 }')
do
echo "Disconnecting $interface from non-internal device network"
networksetup -removepreferredwirelessnetwork $interface "SFR WiFi FON"
networksetup -removepreferredwirelessnetwork $interface "FreeWiFi"
networksetup -removepreferredwirelessnetwork $interface "orange"
networksetup -removepreferredwirelessnetwork $interface "WIFI-AIRPORT"
networksetup -removepreferredwirelessnetwork $interface "WIFI-AIRPORT-STANDARD"
networksetup -removepreferredwirelessnetwork $interface "NiceAirportFreeWifi"
networksetup -removepreferredwirelessnetwork $interface "*Airport-Free-Wifi"
networksetup -removepreferredwirelessnetwork $interface "_Free JFK WiFi"
networksetup -removepreferredwirelessnetwork $interface "_LAX Free WiFi"
networksetup -removepreferredwirelessnetwork $interface "#StarbucksWifi"
networksetup -removepreferredwirelessnetwork $interface "McDonald's France"
networksetup -removepreferredwirelessnetwork $interface "WHOPPER Wi-Fi"
networksetup -removepreferredwirelessnetwork $interface "BK Public"
networksetup -removepreferredwirelessnetwork $interface "EXKi-Public"
networksetup -removepreferredwirelessnetwork $interface "HIPPOSPOT"
networksetup -removepreferredwirelessnetwork $interface "PRET_A_MANGER"
networksetup -removepreferredwirelessnetwork $interface "Quick_WiFi"
networksetup -removepreferredwirelessnetwork $interface "WIFI_KFC"
networksetup -removepreferredwirelessnetwork $interface "_FLUNCH_PUBLIC"
networksetup -removepreferredwirelessnetwork $interface "BNF"
networksetup -removepreferredwirelessnetwork $interface "_SNCF_WIFI_INOUI"
networksetup -removepreferredwirelessnetwork $interface "EurostarTrainsWiFi"
networksetup -removepreferredwirelessnetwork $interface "RATP_Gratuit"
networksetup -removepreferredwirelessnetwork $interface "Paris Wi-Fi"
networksetup -removepreferredwirelessnetwork $interface "Wifi-Marseille"
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment