3

I'd like to find a way to add a specific SSID to the top of the preferred WiFi networks in System Preferences > Network > WiFi > Advanced. (10.9 Mavericks and beyond)

According to the man page, this should do it:

-addpreferredwirelessnetworkatindex hardwareport network index securitytype [password]

However, it doesn't appear the 'index' aspect actually sets one network name above the other. Is there a way to set this via terminal and/or run via bash?

2

A couple of things to consider:

  • Supposedly, specifying 0 for the index puts it at the front of the list.

  • You need at least admin privilege and may need root privilege. Have you tried it with:
    sudo networksetup -addpreferredwirelessnetworkatindex ...?

  • If the wireless network is already a preferred network, you may need to remove it first before adding it again. That is, it may be ignoring the index if the network already has an index. Assuming your wireless port is en1, you can get the list of preferred networks with:
    networksetup -listpreferredwirelessnetworks en1. I admit that I'm just guessing here.

  • If you have multiple wireless ports, it will of course make a difference which one you add this service to. You can list all your hardwareports, wireless and otherwise, with: networksetup -listnetworkserviceorder

  • I receive confirmation regardless of sudo access. We made sure to remove the ssid in question before adding it to index 0. We confirmed that the network was removed from the known networks, added it via -addpreferredwirelessnetworkatindex and confirmed it was added just not in any specific spot (e.g. index 0, 1, 4) – seventymeters Jan 6 '15 at 6:31

You must log in to answer this question.

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