Link to home
Start Free TrialLog in
Avatar of baadayakazi
baadayakazi

asked on

Change Mac Settings Automatically Based on Location

I'm looking for an automatic location switcher based on my Mac's location. For instance, when I go to the office I need wifi to automatically turn off when I plug in my USB-C hub and/or network cable (the network cable is plugged into the hub).  In the past I would have used Marco Polo, SideKick, or ControlPlane, but those no longer work on the Mac. I'm using Mac OS Mojave.
Avatar of Owen Rubin
Owen Rubin
Flag of United States of America image

For network, you can rearrange the order of your network interfaces to the priority order you want (higher priority is higher in the list) in the network setting pane. They will connect in that order top to bottom. So if you put the USB-C network item above Wifi, when the USB-C network connection goes "green' (connected) the Mac will automatically switch to that network connection and "ignore" WiFi while connected. It does not turn WiFi off, but the network will switch properly and WiFi will not be used.
Avatar of Eoin OSullivan
You've just listed the best apps for OSX to achieve what you want and they are all outdated!!

I think you might be suffering from early-adopter problems .. and may have to wait for Marco Polo, SideKick, or ControlPlane to be updated for OSX but this may never happen.  

Personally I avoid updating OSX until the 10.x.2 or even 10.x.3 release in the hope that all my apps will have been updated and tested by that point.  Not all developers update their apps BEFORE the OSX autumn release and often it can be months before new versions come out.

There's an additional issue that OSX Mojave is the last OSX version with 32 bit support and there'll be a huge cull on applications next year when they drop fully support for 32 bit apps.  If you do get a version of Marco Polo, SideKick, or ControlPlane to work on OSX Mojave I'd recommend NOT updating to the next OSX version in 2019 unless you're fully sure all your important apps work.
https://9to5mac.com/2018/06/05/macos-mojave-32-bit-support/

I'm sure you're well aware that OSX itself never had an automatic location switcher feature and OSX Mojave is no different I'm afraid.
In MacOSX Mojave then go into the Network settings and click on the lock, enter an administrator username and password and then select the Cog from the bottom of the network list and "Set Service Order...."

From here you can drag the services to change their order - so as Owen rightly pointed out if your USB-C network is active prior to Wi-Fi then you will use that service primarily.

Click Okay and then Apply and you're all set.
Following up on my post above - due to the lack of 3rd party apps .. if you only need to toggle WiFi on and off it might be possible to achieve this with an AppleScript and run it as a quick link when you're in a specific location.  It's not full automation but could be a quick click to toggle it on/off if the reordering of the network devices (as advised by other experts here) does not achieve what you want.

Here's a sample script to achieve this ..
https://gist.github.com/viktorklang/9140756

If you really want to automate it .. it is possible to have a script which runs every x seconds or minutes when the laptop is open ... looks for a specific device or network connection and if it exists or doesn't it can toggle on/off the wifi.  It would be a more complicated solution but it is possible.
Maybe we need some more info here. I do not believe from what I read that you care if WiFi turns on or off, just that the right network is used. Am I right?

If so, what I posted above, and Vinny repeated with a bit more detail does what you need.

If you really need Wifi to turn off, can you tell us why?
Avatar of baadayakazi
baadayakazi

ASKER

Yes - I do need wifi turned off when the ethernet is connected. It's hard to explain, but essentially both are on different networks and if I leave wifi on, I end up access resources on both.
Thanks. I am surprised that the Mac keeps both networks active (never tried two different networks like that before) as that is not usually how they work. I wonder if they detect two different networks and then the auto-priority is overridden and not used. I need to go run that test now!  :-)

Thanks, hopefully someone here will have a solution for turning the WiFi physically off.
As I showed above you can script the toggle of WiFi on and off .. if you want an example of a script which AUTOMATICALLY detects when Ethernet is connected and disables WiFi .. this one is works on OSX Yosemite but should work on OSX Mojave also.
https://gist.github.com/albertbori/1798d88a93175b9da00b
Cool. I am going to try it.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.