Skip to main content
Version: 2.21.0

Configure proxy using IP address on macOS

This guide explains how to replace a proxy DNS hostname with a direct IP address on macOS, using either the network settings GUI or a shell script.

This is useful in environments where:

  • DNS resolution is unreliable or slow
  • You need to route traffic through a specific egress IP
  • Consistent IP usage is required for conditional access or firewall rules

Manual method (System Settings)​

  1. Open System Settings → Network
  2. Select your current network (e.g., Wi-Fi or Ethernet)
  3. Click Details → Proxies
  4. Under:
    • Web proxy (HTTP) and
    • Secure web proxy (HTTPS) Replaceproxy.company.comwith the IP address of the proxy (e.g.,192.168.1.10)
  5. Set the port (usually8080)
  6. 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