How to Configure a Datacenter Proxy on Mac

Configure a datacenter proxy on Mac via System Settings or networksetup CLI. Covers Wi-Fi, Ethernet, per-app config, env vars, testing, and common errors.

Jun 13, 2026 - 12:52
Jun 2, 2026 - 12:18
 2
How to Configure a Datacenter Proxy on Mac
How to Configure a Datacenter Proxy on Mac
  

Table of Contents

  • What Is a Datacenter Proxy on Mac? {#what-is-datacenter-proxy-mac}

    Configuring a datacenter proxy on Mac is straightforward in concept, but has one quirk that trips up most users: macOS applies proxy settings per network service, not system-wide. Set it on Wi-Fi and then switch to Ethernet or a USB adapter, your proxy disappears. This guide covers every method to configure proxy Mac settings correctly: System Settings (GUI), the networksetup command-line tool, environment variables, and per-app configuration for Python, curl, and git.

    A datacenter proxy routes your outbound traffic through a server in a commercial data center, giving you a fixed commercial IP address. On Mac, setting up a datacenter proxy Mac configuration means telling macOS—and the apps running on it—where to send HTTP and HTTPS traffic.

    Unlike Windows, macOS does not split proxy stores between user apps and system services. All macOS apps that respect the system proxy (browsers, most native apps, URLSession-based tools) read from the same proxy settings in System Settings. The challenge is that those settings are per network interface, not global.

    Common Mac datacenter proxy use cases:

    | Use Case | Tool | Best Config Method |

    |---|---|---|

    | Web scraping | Python requests, httpx | Environment variables or proxies dict |

    | Browser automation | Playwright, Selenium | System Settings or launch args |

    | Ad verification | Safari, Chrome, Firefox | System Settings (per network service) |

    | API testing | curl, Postman | -x flag or HTTPS_PROXY env var |

    | Git / npm / pip | git, npm, pip | Per-tool config or env vars |

    | Server-side scripts | Bash, Python | HTTP_PROXY / HTTPS_PROXY env vars |


  • Mac Proxy Setup via System Settings {#mac-proxy-setup-system-settings}

    System Settings is the easiest way to set up a Mac proxy for browser-based and GUI app traffic. These steps apply to macOS Ventura (13) and later.

    • Step 1 — Identify Your Active Network Service

      Open System SettingsNetwork in the sidebar.

      You will see a list of network services — for example:

      • Wi-Fi
      • Ethernet
      • Thunderbolt Bridge
      • USB 10/100/1000 LAN

      Find the service currently marked as Connected. You must configure the proxy on this specific service. If you use multiple interfaces (e.g., Wi-Fi at home and Ethernet in the office), configure each one.

    • Step 2 — Open the Proxies Panel

      1. Click your connected network service (e.g., Wi-Fi)
      2. Click Details…
      3. Click the Proxies tab
    • Step 3 — Disable Auto Proxy Discovery

      Turn off Auto proxy discovery unless your network administrator has set up WPAD/DHCP-based proxy discovery. Leaving it on can override your manual settings on networks that broadcast a WPAD record.

    • Step 4 — Enable Web Proxy (HTTP)

      Turn on Web proxy (HTTP). Enter:

      • Server: gateway.sparkproxy.io
      • Port: 10000

      If your proxy requires credentials, turn on Proxy server requires password and enter your username and password.

    • Step 5 — Enable Secure Web Proxy (HTTPS)

      Turn on Secure web proxy (HTTPS). Enter the same server and port. Most datacenter proxies use the same endpoint for both HTTP and HTTPS traffic.

      Note: HTTP and HTTPS proxy fields are separate on Mac. A common mistake is filling in only the HTTP field and finding that HTTPS requests (most modern web traffic) still go direct.

    • Step 6 — Configure the Bypass List

      In the Bypass proxy settings for these Hosts & Domains field, enter:

      ```

      localhost, 127.0.0.1, *.local

      ```

      Use commas to separate entries. The *.local entry prevents mDNS-based local hostname lookups from going through the proxy.

    • Step 7 — Click OK and Apply

      Click OK, then Apply (if prompted). Changes take effect for new connections immediately.


  • Configure a Proxy on Mac via networksetup (Terminal) {#configure-via-networksetup}

    The networksetup command is the Terminal equivalent of System Settings' Proxies panel. It is scriptable, idempotent, and essential for automation. All networksetup proxy commands require sudo (or admin credentials).

    • List All Network Services

      Before setting a proxy, identify the exact service name:

      ```bash

      networksetup -listallnetworkservices

      ```

      Example output:

      ```

      An asterisk (*) denotes that a network service is disabled.

      Wi-Fi

      Ethernet

      Thunderbolt Bridge

      USB 10/100/1000 LAN

      ```

      Use the exact name (case-sensitive, spaces included) in all subsequent commands.

    • Get Current Proxy Settings

      ```bash

      Check HTTP proxy

      networksetup -getwebproxy "Wi-Fi"

      Check HTTPS proxy

      networksetup -getsecurewebproxy "Wi-Fi"

      Check SOCKS proxy

      networksetup -getsocksfirewallproxy "Wi-Fi"

      Check bypass domains

      networksetup -getproxybypassdomains "Wi-Fi"

      ```

      Sample output when no proxy is set:

      ```

      Enabled: No

      Server:

      Port: 0

      Authenticated Proxy Enabled: 0

      ```

    • Set HTTP and HTTPS Proxy (IP Whitelist — No Credentials)

      If you use IP whitelisting (your machine's IP is added to the provider whitelist), omit the on username password parameters:

      IP whitelisting for proxies

      ```bash

      HTTP proxy

      sudo networksetup -setwebproxy "Wi-Fi" gateway.sparkproxy.io 10000

      HTTPS proxy

      sudo networksetup -setsecurewebproxy "Wi-Fi" gateway.sparkproxy.io 10000

      ```

    • Set HTTP and HTTPS Proxy with Username-Password Authentication

      ```bash

      HTTP proxy with credentials

      sudo networksetup -setwebproxy "Wi-Fi" gateway.sparkproxy.io 10000 on YOUR_USER YOUR_PASS

      HTTPS proxy with credentials

      sudo networksetup -setsecurewebproxy "Wi-Fi" gateway.sparkproxy.io 10000 on YOUR_USER YOUR_PASS

      ```

      The on argument enables authenticated proxy support. Credentials are stored in the macOS System Keychain.

    • Enable / Disable the Proxy Without Changing Settings

      ```bash

      Enable

      sudo networksetup -setwebproxystate "Wi-Fi" on

      sudo networksetup -setsecurewebproxystate "Wi-Fi" on

      Disable (keep settings, just turn off)

      sudo networksetup -setwebproxystate "Wi-Fi" off

      sudo networksetup -setsecurewebproxystate "Wi-Fi" off

      ```

    • Set Proxy Bypass Domains

      ```bash

      sudo networksetup -setproxybypassdomains "Wi-Fi" localhost 127.0.0.1 "*.local"

      ```

      Pass each domain as a separate argument. Use "Empty" to clear all bypass entries:

      ```bash

      sudo networksetup -setproxybypassdomains "Wi-Fi" "Empty"

      ```

    • Verify Settings

      ```bash

      networksetup -getwebproxy "Wi-Fi"

      ```

      Expected output after configuration:

      ```

      Enabled: Yes

      Server: gateway.sparkproxy.io

      Port: 10000

      Authenticated Proxy Enabled: 0

      ```


  • Per-Service Proxy: Why Mac Is Different from Windows {#per-service-proxy}

    This is the most important architectural difference between macOS and Windows proxy configuration:

    ```

    macOS Proxy Architecture

    ─────────────────────────────────────────────────────────

    Wi-Fi → Proxy: gateway.sparkproxy.io:10000 ✓

    Ethernet → Proxy: (none — inherits nothing) ✗

    USB LAN → Proxy: (none — inherits nothing) ✗

    Thunderbolt → Proxy: (none — inherits nothing) ✗

    ─────────────────────────────────────────────────────────

    Each service has its own independent proxy config.

    Changing one does NOT affect the others.

    ```

    Real-world scenario: You configure a datacenter proxy on your Wi-Fi at your desk. Later, you plug in a USB Ethernet adapter for a faster connection. Your traffic now bypasses the proxy entirely — because Ethernet has no proxy configured. Your scripts appear to work, but the exit IP is your real IP.

    On Windows, configuring the proxy in Windows Settings (WinINet) applies across all network interfaces. macOS does not work this way.

    Fix: Configure the proxy on every network service you use, or use the shell script in the next section to configure all services at once.


  • Configure All Network Services at Once (Shell Script) {#configure-all-services}

    This script reads all active network services and applies the proxy to each one, solving the per-service problem:

    ```bash

    #!/bin/bash

    configure-mac-proxy.sh

    Sets datacenter proxy on all network services at once.

    Usage: sudo bash configure-mac-proxy.sh

    PROXY_HOST="gateway.sparkproxy.io"

    PROXY_PORT="10000"

    BYPASS_DOMAINS="localhost 127.0.0.1 *.local"

    Get all services, skip the header line

    services=$(networksetup -listallnetworkservices | tail -n +2)

    while IFS= read -r service; do

    Skip disabled services (prefixed with *)

    if [[ "$service" == \** ]]; then

    echo "Skipping disabled service: $service"

    continue

    fi

    echo "Configuring proxy for: $service"

    networksetup -setwebproxy "$service" "$PROXY_HOST" "$PROXY_PORT"

    networksetup -setsecurewebproxy "$service" "$PROXY_HOST" "$PROXY_PORT"

    networksetup -setproxybypassdomains "$service" $BYPASS_DOMAINS

    echo " Done: $service"

    done <<< "$services"

    echo ""

    echo "Proxy configured on all active network services."

    echo "Run 'networksetup -getwebproxy \"Wi-Fi\"' to verify."

    ```

    Run with:

    ```bash

    sudo bash configure-mac-proxy.sh

    ```

    To remove the proxy from all services, replace the setwebproxy calls with setwebproxystate "$service" off.


  • Per-App Proxy Configuration on Mac {#per-app-proxy}

    For scripting and automation, set the proxy at the application level to keep configurations portable and explicit.

    • curl

      ```bash

      With credentials

      curl --proxy http://user:[email protected]:10000 https://httpbin.org/ip

      With IP whitelisting (no credentials)

      curl --proxy gateway.sparkproxy.io:10000 https://httpbin.org/ip

      Permanent config in ~/.curlrc

      echo 'proxy = "gateway.sparkproxy.io:10000"' >> ~/.curlrc

      ```

    • Python requests

      ```python

      import requests

      With credentials

      proxies = {

      "http": "http://user:[email protected]:10000",

      "https": "http://user:[email protected]:10000",

      }

      With IP whitelisting

      proxies = {

      "http": "http://gateway.sparkproxy.io:10000",

      "https": "http://gateway.sparkproxy.io:10000",

      }

      response = requests.get("https://httpbin.org/ip", proxies=proxies)

      print(response.json()) # {"origin": ""}

      ```

    • httpx (async Python)

      ```python

      import httpx

      proxies = {"https://": "http://user:[email protected]:10000"}

      with httpx.Client(proxies=proxies) as client:

      r = client.get("https://httpbin.org/ip")

      print(r.json())

      ```

    • git

      ```bash

      git config --global http.proxy http://user:[email protected]:10000

      git config --global https.proxy http://user:[email protected]:10000

      Remove

      git config --global --unset http.proxy

      git config --global --unset https.proxy

      ```

    • pip / Homebrew

      ```bash

      pip

      pip install some-package --proxy http://user:[email protected]:10000

      Homebrew reads HTTPS_PROXY environment variable automatically

      export HTTPS_PROXY=http://user:[email protected]:10000

      brew update

      ```


  • Set Environment Variables for Proxy on Mac {#environment-variables}

    Environment variables are the universal proxy mechanism for Terminal tools on macOS. Most CLI tools — curl, wget, git, npm, pip, Python urllib — read these automatically.

    • Set for Current Terminal Session

      ```bash

      export HTTP_PROXY="http://user:[email protected]:10000"

      export HTTPS_PROXY="http://user:[email protected]:10000"

      export NO_PROXY="localhost,127.0.0.1,*.local"

      ```

      With IP whitelisting (no credentials in URL):

      ```bash

      export HTTP_PROXY="http://gateway.sparkproxy.io:10000"

      export HTTPS_PROXY="http://gateway.sparkproxy.io:10000"

      ```

    • Make Persistent Across Sessions

      Add to ~/.zshrc (Zsh — default on macOS Catalina and later) or ~/.bash_profile (Bash):

      ```bash

      echo 'export HTTP_PROXY="http://user:[email protected]:10000"' >> ~/.zshrc

      echo 'export HTTPS_PROXY="http://user:[email protected]:10000"' >> ~/.zshrc

      echo 'export NO_PROXY="localhost,127.0.0.1,*.local"' >> ~/.zshrc

      source ~/.zshrc

      ```

    • Unset for Current Session

      ```bash

      unset HTTP_PROXY

      unset HTTPS_PROXY

      unset NO_PROXY

      ```

      Security note: Credentials embedded in environment variables are visible to other processes running as the same user via ps, env, or /proc. For production use, prefer IP whitelisting or pass credentials directly to each tool via its native config file.

      proxy authentication methods


  • Test Your Datacenter Proxy on Mac {#test-proxy}

    After configuring your proxy, verify the exit IP before running your actual workload.

    • Test 1 — Check Exit IP (curl)

      ```bash

      curl https://httpbin.org/ip

      ```

      The origin field should show your proxy's datacenter IP, not your local IP.

    • Test 2 — Check System Proxy Is Active (curl reading System Settings)

      By default on macOS, curl does not automatically read System Settings proxy. Pass -x explicitly or use --proxy-use-network on recent versions. To force curl to use the system proxy:

      ```bash

      Use system proxy via environment variable (set from System Settings)

      export HTTPS_PROXY="http://gateway.sparkproxy.io:10000"

      curl https://httpbin.org/ip

      ```

      Or test directly:

      ```bash

      curl -x gateway.sparkproxy.io:10000 https://httpbin.org/ip

      ```

    • Test 3 — Verify networksetup Settings Applied

      ```bash

      networksetup -getwebproxy "Wi-Fi"

      networksetup -getsecurewebproxy "Wi-Fi"

      ```

      Both should show Enabled: Yes with your proxy host and port.

    • Test 4 — Browser Test (Safari / Chrome)

      Open Safari or Chrome and visit https://httpbin.org/ip. Because these browsers respect System Settings proxy on macOS, the IP returned should be your datacenter proxy's exit IP, not your ISP-assigned IP.


  • Disable or Remove a Proxy on Mac {#disable-proxy}

    • Disable via System Settings

      1. System Settings → Network → [service] → Details → Proxies
      2. Turn off Web proxy (HTTP) and Secure web proxy (HTTPS)
      3. Click OKApply
    • Disable via Terminal (Keep Settings, Just Turn Off)

      ```bash

      sudo networksetup -setwebproxystate "Wi-Fi" off

      sudo networksetup -setsecurewebproxystate "Wi-Fi" off

      ```

    • Remove Settings Completely via Terminal

      ```bash

      Clear HTTP proxy

      sudo networksetup -setwebproxy "Wi-Fi" "" 0

      sudo networksetup -setwebproxystate "Wi-Fi" off

      Clear HTTPS proxy

      sudo networksetup -setsecurewebproxy "Wi-Fi" "" 0

      sudo networksetup -setsecurewebproxystate "Wi-Fi" off

      Clear bypass domains

      sudo networksetup -setproxybypassdomains "Wi-Fi" "Empty"

      ```

    • Remove Environment Variables

      ```bash

      unset HTTP_PROXY HTTPS_PROXY NO_PROXY

      If added to ~/.zshrc, remove the export lines:

      nano ~/.zshrc

      Delete the proxy export lines, then:

      source ~/.zshrc

      ```


  • Common Proxy Errors on Mac and Fixes {#common-errors}

    | Error | Cause | Fix |

    |---|---|---|

    | curl: (56) Proxy CONNECT aborted | Proxy host unreachable or port blocked | Test nc -zv gateway.sparkproxy.io 10000; check firewall |

    | 407 Proxy Authentication Required | Credentials wrong or IP not whitelisted | Verify user/pass or add machine IP to whitelist in dashboard |

    | Proxy set in System Settings, browser still direct | Set on wrong network service (e.g., Ethernet instead of Wi-Fi) | Check which service shows Connected and configure that one |

    | Proxy works in Safari, fails in Python script | requests doesn't read System Settings by default | Pass proxies= dict or set HTTPS_PROXY env var |

    | SSLError: CERTIFICATE_VERIFY_FAILED in Python | Proxy doing TLS interception; cert not trusted by Python | Set verify=False for testing only; for production install proxy CA cert |

    | Proxy stops after sleep/wake | DHCP renewed IP; IP whitelist entry expired | Use username-password auth or assign a static IP; re-add IP to whitelist |

    | networksetup: You need administrator access | Not running with sudo | Prefix command with sudo |

    | Service name not found | Case-sensitive or wrong service name | Run networksetup -listallnetworkservices to get exact names |

    | curl ignores System Settings proxy | macOS curl does not auto-read System Settings | Set HTTPS_PROXY env var or use -x flag explicitly |


  • About the Author

    SparkProxy Technical Team — The SparkProxy engineering team builds and maintains global datacenter and residential proxy infrastructure. This guide reflects configuration patterns tested across macOS Ventura, Sonoma, and Sequoia.

    Citations: Change proxy settings on Mac — Apple Support · Enter proxy server settings on Mac — Apple Support