{"id":19138151,"url":"https://github.com/locus313/macos-wireless-autoswitch","last_synced_at":"2026-06-20T12:32:20.168Z","repository":{"id":42006302,"uuid":"471610730","full_name":"locus313/macos-wireless-autoswitch","owner":"locus313","description":"A lightweight macOS system utility that automatically toggles WiFi off when wired Ethernet is connected and back on when disconnected. Features real-time network monitoring via LaunchDaemon, multi-adapter support (Ethernet/Thunderbolt/USB-C), and seamless integration with macOS Ventura, Sonoma, and Sequoia. Perfect for eliminating network conflicts","archived":false,"fork":false,"pushed_at":"2025-09-26T10:32:46.000Z","size":128,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T12:20:28.548Z","etag":null,"topics":["ethernet-detection","launchd","macos","network-management","system-utility","wifi-automation","wireless"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/locus313.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"locus313"}},"created_at":"2022-03-19T06:23:50.000Z","updated_at":"2025-09-26T10:32:41.000Z","dependencies_parsed_at":"2025-10-02T11:01:47.354Z","dependency_job_id":null,"html_url":"https://github.com/locus313/macos-wireless-autoswitch","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/locus313/macos-wireless-autoswitch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locus313%2Fmacos-wireless-autoswitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locus313%2Fmacos-wireless-autoswitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locus313%2Fmacos-wireless-autoswitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locus313%2Fmacos-wireless-autoswitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locus313","download_url":"https://codeload.github.com/locus313/macos-wireless-autoswitch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locus313%2Fmacos-wireless-autoswitch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34570534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethernet-detection","launchd","macos","network-management","system-utility","wifi-automation","wireless"],"created_at":"2024-11-09T06:41:55.035Z","updated_at":"2026-06-20T12:32:20.157Z","avatar_url":"https://github.com/locus313.png","language":"Shell","funding_links":["https://github.com/sponsors/locus313"],"categories":[],"sub_categories":[],"readme":"# macOS Wireless Auto-Switch\n\n[![macOS](https://img.shields.io/badge/macOS-Sonoma%20|%20Sequoia%20|%20Tahoe-blue?style=flat-square)](https://www.apple.com/macos/)\n[![Bash](https://img.shields.io/badge/Bash-4+-green?style=flat-square)](https://www.gnu.org/software/bash/)\n[![License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)](LICENSE)\n\n⭐ If you like this project, star it on GitHub — it helps a lot!\n\n[Features](#features) • [Installation](#installation) • [Usage](#usage) • [How it works](#how-it-works) • [Troubleshooting](#troubleshooting)\n\nA lightweight macOS utility that automatically toggles WiFi off when a wired Ethernet connection is detected, and back on when disconnected. Perfect for eliminating network conflicts and ensuring optimal connection performance without manual intervention.\n\n## Features\n\n- **Automatic WiFi Management** - Seamlessly switches WiFi off/on based on wired connection status\n- **Real-time Network Monitoring** - Uses macOS LaunchDaemon for instant network state detection\n- **Multi-adapter Support** - Works with Ethernet, Thunderbolt, LAN, and USB-C adapters (including AX88179A)\n- **System Integration** - Runs as a native macOS system service with proper logging\n- **Smart IP Detection** - Ignores loopback and self-assigned addresses for accurate connection status\n- **Modern macOS Support** - Compatible with Sonoma (14.x), Sequoia (15.x), and Tahoe (16.x)\n\n## Installation\n\n### Prerequisites\n\n- macOS Sonoma (14.x) or later\n- Administrator privileges for system installation\n- Bash 4+ (included with modern macOS)\n\n### Quick Start\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/locus313/macos-wireless-autoswitch.git\n   cd macos-wireless-autoswitch\n   ```\n\n2. Install the service:\n   ```bash\n   ./install.sh i\n   ```\n\nThe installer automatically:\n- Copies scripts to `/Library/Scripts/NetBasics/`\n- Installs the LaunchDaemon configuration\n- Sets proper permissions and ownership\n- Starts monitoring network changes immediately\n\n\u003e [!NOTE]\n\u003e Installation requires `sudo` privileges to create system-level components.\n\n## Usage\n\n### Management Commands\n\nUse the `install.sh` script for all management operations:\n\n```bash\n# Install the service\n./install.sh i\n\n# Update to latest version  \n./install.sh up\n\n# Uninstall completely\n./install.sh ui\n\n# Interactive menu\n./install.sh\n```\n\n### Verification\n\nAfter installation, verify the service is working:\n\n```bash\n# Check LaunchDaemon status\nsudo launchctl list | grep com.computernetworkbasics.wifionoff\n\n# View logs\nlog show --predicate 'subsystem == \"com.apple.console\"' --info --last 1h | grep wireless.sh\n```\n\n## How it works\n\nThe system consists of three components working together:\n\n### Network Detection Engine (`wireless.sh`)\n- Automatically scans for wired network interfaces using hardware port detection\n- Validates active connections by checking for legitimate IP addresses\n- Controls WiFi state using `networksetup -setairportpower` commands\n- Implements smart filtering to exclude loopback and self-assigned addresses\n\n### System Monitoring (`com.computernetworkbasics.wifionoff.plist`)\n- LaunchDaemon watches `/Library/Preferences/SystemConfiguration` for network changes\n- Triggers the wireless script whenever network configuration is modified\n- Runs with root privileges for system-level network control\n- Uses throttling to prevent excessive execution during rapid network changes\n\n### Management Interface (`install.sh`)\n- Provides interactive installation, update, and removal capabilities\n- Handles proper permission setting and system integration\n- Includes sudo privilege detection and validation\n- Offers both command-line and menu-driven operation modes\n\n### Supported Network Adapters\n\nThe utility automatically detects and works with:\n- Built-in Ethernet ports\n- Thunderbolt Ethernet adapters\n- USB-C Ethernet adapters (including AX88179A chipset)\n- Any interface with \"LAN\" designation\n\n## Troubleshooting\n\n### Common Issues\n\n**WiFi not switching automatically:**\n```bash\n# Restart the service\nsudo launchctl unload /Library/LaunchDaemons/com.computernetworkbasics.wifionoff.plist\nsudo launchctl load /Library/LaunchDaemons/com.computernetworkbasics.wifionoff.plist\n```\n\n**Script not detecting wired connection:**\n```bash\n# Test detection manually\nsudo /Library/Scripts/NetBasics/wireless.sh\n\n# Check available interfaces\nnetworksetup -listallhardwareports\n```\n\n**Permission errors:**\n```bash\n# Verify file permissions\nls -la /Library/Scripts/NetBasics/wireless.sh\nls -la /Library/LaunchDaemons/com.computernetworkbasics.wifionoff.plist\n```\n\n### Manual Testing\n\nTest the core functionality directly:\n\n```bash\n# Run detection script manually\nsudo /Library/Scripts/NetBasics/wireless.sh\n\n# Check current WiFi status\nnetworksetup -getairportpower Wi-Fi\n\n# List detected wired interfaces\nnetworksetup -listnetworkserviceorder | grep \"Hardware Port\" | grep \"Ethernet\\|LAN\\|Thunderbolt\\|AX88179A\"\n```\n\n### System Requirements\n\n- **macOS Version**: Sonoma (14.x), Sequoia (15.x), or Tahoe (16.x)\n- **Shell**: Bash 4+ (included with macOS)\n- **Privileges**: Administrator access for installation\n- **Network Stack**: Standard macOS networking components\n\n## Authors\n\n- **Ryan Lininger** - Original script concept and implementation\n- **locus313** - Modern macOS compatibility, architecture improvements, and maintenance\n\n## Resources\n\n- [macOS LaunchDaemon Documentation](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html)\n- [NetworkSetup Command Reference](https://ss64.com/osx/networksetup.html)\n- [Original Implementation](https://web.archive.org/web/20180508004545/www.computernetworkbasics.com/2012/12/automatically-turn-off-wireless-in-osx-including-mountain-lion/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocus313%2Fmacos-wireless-autoswitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocus313%2Fmacos-wireless-autoswitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocus313%2Fmacos-wireless-autoswitch/lists"}