Making OS X a little smarter: Conditional network configuration


Categories: GeekStuff

So, I have ethernet, but I don’t always use it. If I’m not plugged in, I want my laptop to use the wireless. If I am, I want it to not use the wireless.

Some guy solved this.

His solution is pretty clever, but I’d point out a couple of quibbles: First, I’d probably use LaunchDaemons, not LaunchAgents, for this so it’d be up before I logged in. I would NOT use /System/Library either way; this is a local change and belongs in /Library. Also, I put the script in /usr/local/bin.

The gimmick is that the system can run a script any time the configuration changes, and the script can then, say, evaluate the current state of the wifi and ethernet connections, and select accordingly. This means that simply plugging or unplugging the Ethernet cable causes a toggle, which gets the result I want.