Apple script to switch from the wi-fi I'm on to another wi-fi?

Curious if I can run a shell or apple script that would enable me to switch from the wifi network I'm on to a wi-fi called "Dogs and Cats" back to my other wi-fi "Wild Frontier" if necessary?

MacBook Air (2018 or later)

Posted on Jan 9, 2019 5:25 PM

Reply
2 replies

Jan 9, 2019 5:54 PM in response to mistermax12

Here are the commands that you would use, particularly the netwrosetup tool.


https://www.techrepublic.com/article/pro-tip-manage-wi-fi-with-terminal-commands-on-os-x/

http://osxdaily.com/2011/04/12/connect-wireless-network-command-line/

http://osxdaily.com/2010/05/27/join-network-command-line-mac-os-x/


There are probably shell scripts posted around, depending on exactly what you’re up to here.


If this is your local Wi-Fi network an dyiu’re roaming among different devices, I’d suggest switching the Wi-Fi devices over to their Access Point (bridged) mode, assuming the Wi-Fi devices support that.

Jan 9, 2019 7:41 PM in response to mistermax12

First, you could look at ControlPlane

https://www.controlplaneapp.com/

which can automatically switch your WiFi network based on evidence it can detect around it. For example, if you ONLY see a "Dogs and Cats" in one location, and "Wild Frontier" in another, then ControlPlane can see which is available and automatically switch your WiFi network for you, along with changing other location related configuration settings.


You can look at /usr/sbin/scselect which can switch to a different System Preferences -> Network -> Location and you can configure each Location with specify network preferences.


As MrHoffman says, you can use /usr/sbin/networksetup to make network changes.


You can use

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s

to find all available WiFi networks your Mac can see

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Apple script to switch from the wi-fi I'm on to another wi-fi?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.