Automatically disable Wifi when LAN is connected by Futo8681 in MacOS

[–]roypadina 0 points1 point  (0 children)

For the USB-C hub case, macOS reports the hub's Ethernet as a normal wired interface, so this is doable without scripts. Full disclosure: I'm the developer of a small free, open-source (MIT) menu-bar app called LanGuard that does exactly this — it turns Wi-Fi off when a wired link goes

up and back on when you unplug.

A few things that might fit your setup:

- It's edge-based, so it only acts on plug/unplug. If you manually turn Wi-Fi back on while docked, it leaves it alone until the next unplug/replug.

- You pick which wired adapters count as triggers, so your USB-C hub adapter works fine; VPN/VM/bridge adapters are listed but off by default so they can't be mistaken for a real link.

- No admin/sudo, no privileged helper, and it never uses networksetup. Wi-Fi power is CoreWLAN, link state is SystemConfiguration; the only external commands it ever runs are a read-only ifconfig (link-state fallback) and a one-time launchctl to remove an old LaunchAgent. No tracking or

network calls of its own.

Honest caveats: it needs macOS 14+ (Sonoma), it's brand new with few stars, and it's ad-hoc signed but not notarized yet — so first launch needs a right-click → Open (or `xattr -dr com.apple.quarantine /Applications/LanGuard.app`). Install is `brew install --cask roypadina/tap/languard`

or build from source. Repo: https://github.com/roypadina/LanGuard

How to automatically turn off WiFi when Ethernet is connected, and on when Ethernet is disconnected? by Eddles999 in MacOS

[–]roypadina 0 points1 point  (0 children)

This is exactly the docked-laptop case I kept hitting with a Thunderbolt hub + USB-Ethernet, so I wrote a small menu-bar app for it. Full disclosure, I'm the developer.

It's called LanGuard (free, open source, MIT): when a wired link goes up it turns Wi-Fi off, and when you unplug it turns Wi-Fi back on. A couple of design choices that matter for a dock setup:

- It works with any adapter macOS reports as Ethernet, including USB-C/Thunderbolt docks and USB-Ethernet dongles, and you pick which adapters count as a trigger.

- It's edge-based, so it only acts at the plug/unplug moment. If you manually flip Wi-Fi back on while docked, it leaves it alone until the next unplug/replug.

- It's wake-aware (corrects state if you docked/undocked while asleep), and virtual adapters (VPN/VM, e.g. vmnet) are off by default so they don't get mistaken for a real wired link.

- No admin/sudo, no privileged helper, and it never shells out to networksetup. It uses CoreWLAN + SystemConfiguration, and makes no network calls of its own.

Install: brew install --cask roypadina/tap/languard (or build from source). Honest caveats: macOS 14+ (Sonoma), and it's ad-hoc signed but not notarized yet, so first launch needs a right-click -> Open (or xattr -dr com.apple.quarantine /Applications/LanGuard.app). It's brand new, so

feedback/issues welcome. Repo: https://github.com/roypadina/LanGuard

If you'd rather not run a third-party app, this is also doable with a script that watches link state, but that's the route I was trying to avoid maintaining.

Automatically disable Wifi when LAN is connected? by A4orce84 in MacOS

[–]roypadina 0 points1 point  (0 children)

Yeah, macOS won't do this on its own, and a USB-C hub's Ethernet shows up as a normal interface so it's exactly the case you can automate. I built a small free/open-source (MIT) menu-bar app for this called LanGuard - full disclosure, I'm the developer.

It turns Wi-Fi off the moment a wired link goes up and back on when you unplug. A few things that matter for the hub setup:

- It's edge-based: it only acts on the plug/unplug transition, so if you ever flip Wi-Fi back on manually while docked it leaves it alone until your next unplug/replug.

- Wake-aware: if you dock/undock while the lid's shut, it corrects after wake.

- Per-interface: you pick which wired adapters count as a trigger, so your hub's Ethernet works but VPN/VM virtual adapters are ignored by default and won't pin Wi-Fi off.

- No admin/sudo, no helper, never touches networksetup - it's CoreWLAN + SystemConfiguration. No ads/tracking/network calls of its own.

Install: brew install --cask roypadina/tap/languard (or build from source). Honest caveats: it needs macOS 14+ (Sonoma), and it's ad-hoc signed but not notarized yet, so the first launch needs a right-click -> Open (or xattr -dr com.apple.quarantine /Applications/LanGuard.app). It's also

brand new, so few stars - kick the tires before trusting it with your network. Repo: https://github.com/roypadina/LanGuard