Skip to content

Instantly share code, notes, and snippets.

@lucascantor
Last active January 27, 2018 07:58
Show Gist options
  • Save lucascantor/c104f6129e0445bd15f901de3ab63076 to your computer and use it in GitHub Desktop.
Save lucascantor/c104f6129e0445bd15f901de3ab63076 to your computer and use it in GitHub Desktop.
Remove a specific wifi network SSID from the list of remembered wifi networks
#!/bin/bash
for interface in $(networksetup -listnetworkserviceorder | grep Hardware | awk '/Wi-Fi/ { print $NF }' | awk -F ")" '{ print $1 }')
do
echo "Forgetting non-preferred SSID for $interface"
networksetup -removepreferredwirelessnetwork $interface <SSID to forget>
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment