I was tearing my hair out trying to understand why my MacBook repeatedly joined a WiFi network, despite my removing the SSID from the preferred networks list and deleting the AirPort network password from the System Keychain. I was attempting to force my MacBook to only associate with the 5GHz version of a WiFi network (on an Airport Extreme Base Station), but no matter what I did I would find that the MacBook occasionally reverted to associating with the original 2GHz SSID again.
The mystery was solved with the discovery that as well as the WiFi Preferred Networks list, there is a hidden trusted networks list buried deep within Mac OS X. Even if you remove a network SSID from the visible lists, your MacBook can still silently associate with previously saved networks.
Mac OS X retains WiFi network information and authentication credentials in the com.apple.airport.preferences.plist
file which is located in the /Library/Preferences/SystemConfiguration
folder.
To remove WiFi networks, either delete the individual networks from the KnownNetworks key using Property List Editor, or delete the file altogether and allow AirPort to rebuild it. It’s probably a good idea to turn AirPort off before editing the file.
There is an old Apple knowledge base article – AirPort: How to reset the trusted networks list – which also describes this.