Question:
Nick writes: I have a question about setting SSID priorities in macOS (and IOS devices since iCloud).
[Editor’s note: SSID stands for Service Set IDentifier, and it’s the name assigned to a Wi-Fi network.]
I have a work laptop (MBP Early 2015 running 10.12.4) that is also signed into my iCloud account, so it shares SSID priority with all of my other devices. Problem is, I have a Meraki work device at home, so it broadcasts corporate SSIDs, and of course, I have my personal SSIDs at home also. At work, this arrangement is fine. When working from home, the MBP tends to want to go to my home SSID when it wakes up from sleep, then I have to force it over to my corporate SSID. If I set the corp SSID at the top of the list, this of course propagates to my other devices causing them to want to join that SSID.
I’ve played with Locations in Network in System Preferences, but that doesn’t seem to do anything.
Any easy way for me to tell my MBP to join the corporate SSID above and beyond anything else, while not affecting my other Apple devices, short of disconnecting my corporate MBP from iCloud? I’m open to running a utility to force the behavior.
Answer:
Clearly you want to keep your home network as the top choice so your other devices don’t all connect to this Meraki contraption. While you could manually select your corporate network after you wake the machine, that’s not very geeky, so I started thinking about how to do this programmatically, and we’re sure we can get you there.
Let’s go with AppleScript as a way to connect to the network. I found a dandy command called networksetup (you can go into the Terminal and type this and it will show all the options). If you run Script Editor, you can execute a terminal command (a.k.a shell script) like so:
do shell script "networksetup -setairportnetwork en1 'Meraki SSID’ ‘password'"
Your Wi-Fi network interface is most likely “en1” but it could be something different. If you’re in the Terminal, type “ifconfig” and you’ll see a list of all your network interfaces. With Wi-Fi selected in Network System Preferences, you should see one in the output of “ifconfig” marked as active.
You could save this as an Application and run it when you want to connect to your corporate SSID versus your home SSID. However, with a little more effort, we can automate this action.
Automating the Solution
There look to be a few options for a utility that can run an AppleScript upon wake:
This utility advertises itself as giving you “context sensitive computing” in that it allows you to take a Context (which defaults to your Network locations) combined with Evidences Sources (of which a sleep/wake event is one) and Rules, which can then perform an Action (such as running an application, like the above AppleScript, or running a shell script) but I’ve been warned learning to do things in the ControlPane environment takes some getting used to. However, it’s free to download, and they do accept donations.
2. Scenario
The author says “Scenario is a little app which enables you to set specific moments to launch AppleScripts.” which sounds like exactly what we want. Doesn’t look bad for $4.99, my only concern is hasn’t been updated for a while, but I don’t see any complaints in the reviews.
This app looks to be able to run a script on system wake, but does a whole lot more, and is $49.95, perhaps overkill for what you’d like to accomplish, but there’s a 30-day trial, and perhaps you’d find some of the other features useful and worth the price.