A beautiful, interactive CLI wizard for macOS network configuration and auto-switching
macNetty simplifies network management for macOS users by providing an elegant command-line interface to create location-based network profiles and automatically switch between them based on your Wi-Fi connection.
- π§ Network Profile Management - Create and delete location-based profiles for different Wi-Fi networks
- π‘ Static IP Configuration - Set custom IP addresses, gateways, and subnet masks
- π DNS Server Configuration - Set custom DNS servers (Google DNS, Cloudflare, OpenDNS, etc.)
- π Proxy Support - Configure HTTP/HTTPS proxies per network location
- π Auto-Switching - Automatically switch network profiles when connecting to different Wi-Fi networks
- ποΈ Easy Profile Deletion - Remove unwanted network profiles with confirmation prompts
- π Apple Silicon Compatible - Uses
ipconfigfor M1/M2/M3 Mac compatibility - π« Zero Dependencies - Pure Bash - no Python, Node.js, or external libraries required
- π¨ Beautiful CLI Interface - Color-coded output with ASCII art for a modern terminal experience
- macOS 10.12 or later
- Administrator (sudo) access
-
Download macNetty:
curl -O https://raw.githubusercontent.com/lakminagamage/macNetty/main/macNetty.sh chmod +x macNetty.sh
-
Run the wizard:
sudo ./macNetty.sh
That's it! No compilation, no dependencies, no package managers.
When you run macNetty, you'll see four options:
[1] Create New Network Profile
[2] Delete Network Profile
[3] Install Auto-Switcher (Set & Forget)
[4] Exit
Create a custom network configuration for a specific Wi-Fi network:
- Enter the exact Wi-Fi SSID (network name)
- Choose whether to use Static IP (optional)
- Enter IP Address, Gateway, and Subnet Mask
- Choose whether to configure a Proxy (optional)
- Enter Proxy Host and Port
- Choose whether to set custom DNS servers (optional)
- Enter Primary DNS (e.g., 8.8.8.8 for Google DNS)
- Enter Secondary DNS (optional, e.g., 8.8.4.4)
Example Use Case: Configure your office Wi-Fi with a static IP, custom DNS, and proxy, while your home Wi-Fi uses DHCP.
Remove an existing network profile:
- Select option [2] from the main menu
- View the list of all available network profiles
- Enter the exact name of the profile you want to delete
- Confirm deletion when prompted
Safety Features:
- Lists all profiles before deletion
- Requires exact profile name match
- Asks for confirmation before removing
- Shows clear success/error messages
Example Use Case: Remove old network profiles for Wi-Fi networks you no longer use, such as previous workplace networks or temporary hotspots.
Set up automatic network profile switching:
- Monitors your Wi-Fi connection every 10 seconds
- Automatically switches to the matching network profile when you connect to a known Wi-Fi network
- Runs silently in the background via macOS LaunchAgent
- Logs activity to
/tmp/wifichanger.log
Perfect for: Users who frequently move between home, office, coffee shops, etc.
macNetty uses macOS's built-in Network Locations feature (networksetup) to create and manage profiles. Each Wi-Fi SSID gets its own location with custom settings.
The auto-switcher works by:
- Creating a monitor script (
~/.locationchanger/monitor.sh) - Installing a LaunchAgent that runs the script every 10 seconds
- Comparing current Wi-Fi SSID to current network location
- Switching locations automatically when they don't match
The monitor script uses ipconfig getsummary en0 for Apple Silicon compatibility, ensuring it works on both Intel and ARM-based Macs.
sudo ./macNetty.sh
# Select [1] Create New Network Profile
# Enter SSID: OfficeWiFi
# Static IP? y
# IP: 192.168.10.100
# Gateway: 192.168.10.1
# Subnet: 255.255.255.0
# Proxy? n
# Custom DNS? nsudo ./macNetty.sh
# Select [1] Create New Network Profile
# Enter SSID: HomeWiFi
# Static IP? n
# Proxy? n
# Custom DNS? y
# Primary DNS: 8.8.8.8 # Google DNS
# Secondary DNS: 8.8.4.4 # Google DNS backup- Google Public DNS: 8.8.8.8 / 8.8.4.4
- Cloudflare DNS: 1.1.1.1 / 1.0.0.1
- OpenDNS: 208.67.222.222 / 208.67.220.220
- Quad9: 9.9.9.9 / 149.112.112.112
sudo ./macNetty.sh
# Select [2] Delete Network Profile
# View the list of profiles
# Enter profile name: OldOfficeWiFi
# Confirm deletion: y
# Profile deleted!sudo ./macNetty.sh
# First, create profiles for each network (option 1)
# Then select [3] Install Auto-Switcher
# Done! Your Mac will now auto-switchCheck if the LaunchAgent is running:
launchctl list | grep wifichangerView logs:
tail -f /tmp/wifichanger.logMake sure you're running with sudo:
sudo ./macNetty.shVerify the location was created:
networksetup -listlocationsCheck current location:
networksetup -getcurrentlocationContributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- IPv6 support
- VPN integration
- Export/import profiles
- Network quality testing (ping, speed test)
- GUI wrapper
- Homebrew formula
- Bluetooth network configuration
This project is licensed under the MIT License.
The Wi-Fi network based automation tool is inspired by eprev's locationchanger script. Thanks for your contribution!
If you find macNetty useful, please:
- β Star this repository
- π Report bugs via Issues
- π‘ Suggest features via Issues
- π’ Share with others who might benefit
Made with β€οΈ for Mac users who love the terminal