0

At home I connect my MacBook Pro, running OS X El Capitan, to the Internet using Ethernet, and share the connection with my phone via Wi-Fi.

At work I connect the MacBook Pro to the company network using Ethernet, and Internet Sharing is not allowed.

Is there a way to automatically turn Internet Sharing on and off depending on which network I am on?

A solution which detects the Ethernet network, somehow, the presence or absence of specific Wi-Fi network, or indeed the actual geographic location would do the job.

I am aware that I can set the 'Location' via the Apple menu, but can that control the Internet Sharing options, and can detecting the location not be done automatically? Selecting the location manually is too much like hard work.

3
  • You could use geofencing, and add the work-network as a 'fence' I suppose. It would take something like a scheduled check to see what network you're on and if it isn't 'home', you can then turn off internet sharing. This might actually be doable using AppleScript or Automator in combination with the Calendar or Reminder app. Dec 7, 2015 at 16:02
  • This is a lot like this question, which I wrote a beautiful answer to. You can adapt the script yourself, in which case please put that in an answer to this question. Else I'll take a look at it later. Dec 7, 2015 at 20:15
  • @agentroadkill That looks promising. I'll have a go and try when I'm next in the office. Might be a few days though.
    – howecome
    Dec 7, 2015 at 21:54

1 Answer 1

1

Yes, you can use ControlPlane. It is designed to do exactly the sort of thing you've mentioned.

Example of setting up an Internet Sharing toggle

You'll need to define a context (like "Home" or "Work" or "Out & About") or a few contexts, and then define what clues show what context is active, and then define what actions to take when a context becomes active or ceases to be active.

In most cases a context corresponds to a location (or vague type of location, like "Out & About"). But you could have a "Hotspot" context and a "Wi-Fi" context and an "Ethernet" context, if that suited your needs better. Or you could have "Metered" and "Unmetered" contexts.

You can also enable multiple simultaneous contexts, but that gets complicated and confusing, and I don't recommend it at first.

You can use presence of networks, geographical location, and perhaps dozens of other things to determine your location/context. It's quite powerful (but after a while you'll notice things missing, like the ability to directly trigger an action from an evidence source, without the need to use a context as an intermediary). I heartily recommend it, even though you may eventually wish it did a lot more than it does.

You must log in to answer this question.

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