Homeaway
A CLI tool to quickly toggle your macOS WiFi between manual (static IP) and DHCP mode.
Features
- 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
Installation
Via RubyGems (Recommended)
gem install homeawayVia curl (One-liner)
curl -L https://raw.githubusercontent.com/GoodBran/homeaway/main/bin/homeaway -o /usr/local/bin/homeaway && chmod +x /usr/local/bin/homeawayFrom Source
git clone https://github.com/GoodBran/homeaway.git
cd homeaway
ruby -Ilib bin/homeawayUsage
Simply run:
homeawayFirst Run
On 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.
Normal Usage
$ 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.42How It Works
Finding Available IP
When 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
Network Commands Used
The tool uses macOS's built-in networksetup command:
-
networksetup -listallhardwareports- Detects WiFi interface -
networksetup -getinfo <device>- Gets current configuration -
networksetup -setmanual <device> <ip> <subnet> <router>- Sets static IP -
networksetup -setdhcp <device>- Enables DHCP -
networksetup -setdnsservers <device> <dns>- Sets DNS -
networksetup -setdnsservers <device> empty- Clears DNS
Requirements
- macOS (uses
networksetupcommand) - Ruby 2.6 or higher
- Administrator privileges (for changing network settings)
Configuration File
# ~/.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.0Security Note
This 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
License
MIT