Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Credit to @adamshand for the original script https://github.com/adamshand/dotfiles/blob/main/bin/darwin/executable_wifi-toggle.sh
# Automatically toggle macOS Wi-Fi based on ethernet status (uses launchd).
# If ethernet is active, Wi-Fi is disabled. If ethernet is inactive, Wi-Fi is enabled.
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
LAUNCHD_SERVICE_NAME="nz.haume.wifi-toggle"
LAUNCHD_SERVICE_FILE="${HOME}/Library/LaunchAgents/${LAUNCHD_SERVICE_NAME}.plist"
DEBUG="yes"