A CLI tool to quickly toggle your macOS WiFi between manual (static IP) and DHCP mode.
- Smart IP Detection: Automatically scans and finds an available IP in your subnet
- DNS Management: Clears DNS settings when switching to DHCP (configurable)
- First-Run Wizard: Interactive setup on first run
- Simple Interface: Just run
homeawayand toggle with a single keypress
gem install homeawaycurl -L https://raw.githubusercontent.com/GoodBran/homeaway/main/bin/homeaway -o /usr/local/bin/homeaway && chmod +x /usr/local/bin/homeawaygit clone https://github.com/GoodBran/homeaway.git
cd homeaway
ruby -Ilib bin/homeawaySimply run:
homeawayOn first run, you'll be prompted to configure:
- Default router address (default: 192.168.1.1)
- Whether to clear DNS when toggling to DHCP (default: yes)
- Default DNS server (default: 8.8.8.8)
Configuration is stored at ~/.config/homeaway/config.yml.
$ homeaway
Current mode: DHCP
Toggle to Manual mode? [Y/n]: y
Scanning for available IP in 192.168.1.x range...
Configuring static IP:
IP Address: 192.168.1.42
Subnet Mask: 255.255.255.0
Router: 192.168.1.1
DNS Server: 8.8.8.8
Successfully switched to Manual mode!
Your IP is now: 192.168.1.42When switching to manual mode, the tool:
- Scans the range 192.168.1.2 through 192.168.1.254
- Pings each IP to check if it's in use
- Returns the first available IP address
The tool uses macOS's built-in networksetup command:
networksetup -listallhardwareports- Detects WiFi interfacenetworksetup -getinfo <device>- Gets current configurationnetworksetup -setmanual <device> <ip> <subnet> <router>- Sets static IPnetworksetup -setdhcp <device>- Enables DHCPnetworksetup -setdnsservers <device> <dns>- Sets DNSnetworksetup -setdnsservers <device> empty- Clears DNS
- macOS (uses
networksetupcommand) - Ruby 2.6 or higher
- Administrator privileges (for changing network settings)
# ~/.config/homeaway/config.yml
router: 192.168.1.1
clear_dns_on_dhcp: true
dns_server: 8.8.8.8
subnet_mask: 255.255.255.0This tool modifies system network settings. On macOS, you may need to:
- Run with sudo:
sudo homeaway - Or grant Terminal/ITerm permission to modify network settings in System Preferences
MIT