From Terminal:
- get the Wi-Fi device (hardwareport), it should be en0 (Device: en0) on Macs without Ethernet
Code:
networksetup -listallhardwareports | grep -A 1 Wi-Fi
- list all known Wi-Fi networks
Code:
networksetup -listpreferredwirelessnetworks en0
- remove a network
Code:
networksetup -removepreferredwirelessnetwork en0 "network name"
Apple:
"If you don't have the option to forget this network
If you're using a supervised device that manages the connection to the Wi-Fi network, you might not have the option to forget that network. Learn more about supervised devices.
If your device never joined the Wi-Fi network, you do not have the option to forget that network. Your device can forget only known Wi-Fi networks, which are the networks it previously joined."
https://support.apple.com/en-us/102480