Configure Proxy Using IP Address on macOS
This guide shows how to replace a proxy hostname (DNS) with a raw IP address on macOS — both manually and using a shell script.
This is useful in environments where:
- DNS resolution is unreliable or delayed
- You want to explicitly route through a known egress IP
- You need consistency for proxy-controlled Conditional Access or firewall rules
Manual Method (System Settings)
- Open System Settings → Network
- Select your current network (e.g., Wi-Fi or Ethernet)
- Click Details → Proxies
- Under:
- Web Proxy (HTTP) and
- Secure Web Proxy (HTTPS)
Replaceproxy.company.comwith the IP address of the proxy (e.g.,192.168.1.10)
- Set the port (usually
8080) - Click OK and Apply
Scripted Method (Bash)
Use this shell script to apply proxy settings using a raw IP address across all network services:
#!/bin/bash
# Define proxy IP and port
PROXY="192.168.1.10"
PORT="8080"
# Get list of all network services (excluding the header)
services=$(networksetup -listallnetworkservices | tail +2)
# Apply proxy settings to each network service
for service in $services; do
echo "Setting IP proxy for: $service"
networksetup -setwebproxy "$service" "$PROXY" "$PORT"
networksetup -setsecurewebproxy "$service" "$PROXY" "$PORT"
networksetup -setproxybypassdomains "$service" $(echo $EXCLUSIONS | tr "," " ")
done