Skip to content

Instantly share code, notes, and snippets.

@keenonkites
keenonkites / wifi-toggle
Last active June 12, 2025 11:05
Other version of script to toggle wifi on and of (evolution of script by albertbori)
#!/bin/bash
# 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"