2

I need to delete a saved public wifi network, which my computer keeps trying to connect to when I'm at home, but I can't open my Network preferences and do it trough the GUI, due to an error in my MacOS installation (see linked question below for details).

I'm guessing there might be a way to do it, through Terminal or digging into a .plist, but haven't been able to find any non-GUI guides to this through searching, so how can this be done?

Why does my Network preference pane freeze every time I open it?

System info: MacBook Pro (Retina, 15-inch, Mid 2015) MacOS Sierra 10.12.6 (16G29)

6

You can check the list of preferred networks with the command:

sudo networksetup -listpreferredwirelessnetworks en1

You can then copy the name of the wifi you want to remove from the list and use the command (replacing wifi_to_be_removed with the name of the wifi):

sudo networksetup -removepreferredwirelessnetwork en1 wifi_to_be_removed

Note: en1 is usually the device name of the single wifi card in a mac that also has a ethernet port. To be sure of the device name use the command:
sudo networksetup -listallhardwareports
to list the various network devices and their denomination.

  • Is there a place I can find other possible device names for my wifi card? When running `-listpreferredwirelessnetworks en1´ I get the error "en1 is not a Wi-Fi interface. ** Error: Error obtaining wireless information." – ssssaaaa Feb 20 '18 at 9:38
  • Just realised I hadn't added my device specs to this post, so have done that now, hopefully that helps. – ssssaaaa Feb 20 '18 at 9:47
  • sudo networksetup -listallhardwareports gives you the list of the devices – Gio Valerio Feb 20 '18 at 15:17
  • updated the answer – Gio Valerio Feb 20 '18 at 18:50
  • cool, I figured out by trial and error that it was en0, but good you updated it for others to find! – ssssaaaa Feb 20 '18 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .