Small helper script for macOS to switch a chosen network service to a static IPv4 plus custom DNS servers.
- Lists all network services (Wi-Fi, Ethernet, Docking Station, etc.).
- Lets you pick one by number.
- Applies the static IP, subnet mask, router (gateway), and DNS servers you configured at the top of the script.
- macOS (uses
networksetup) - Bash
- An IP address that fits the subnet you set
Open set-manual-ip-dns.sh and adjust:
SUBNET="255.255.255.0"
GATEWAY="192.168.1.1"
DNS1="1.1.1.1"
DNS2="8.8.8.8"Make sure the IP you plan to use is in the same network as the gateway.
chmod +x set-manual-ip-dns.sh
./set-manual-ip-dns.sh 192.168.1.100Then pick the service (e.g. Wi-Fi) and confirm with y.
The script shows the new settings afterwards.
- Basic IPv4 format check only (no deeper validation).
- You need sudo to apply changes.
- If DNS fails but IP succeeds (or vice versa) the script will tell you.
Use at your own risk. Double‑check the IP before applying so you do not collide with another device.