Setup & Troubleshooting

How to Set Up a Proxy on macOS

Configure HTTP, HTTPS and SOCKS proxies on a Mac via System Settings and the networksetup command, with authentication, bypass lists, PAC files, Terminal environment variables and troubleshooting.

By Team of Monkeys Editorial Updated 4 min read Affiliate disclosure

This guide contains affiliate links to Geonode. If you buy through them we may earn a commission, at no extra cost to you.

Before you start

Gather your proxy's host, port, protocol (HTTP or SOCKS5) and credentials. Proxy settings on macOS are configured per network service (Wi-Fi, Ethernet), so set them on the connection you actually use.

macOS System Settings (Ventura and later)

  1. Open System Settings → Network.
  2. Select your connection (for example Wi-Fi) and click Details… next to the network you're connected to.
  3. Choose Proxies in the sidebar.
  4. Enable the protocol(s) you need:
    • Web proxy (HTTP) for HTTP traffic.
    • Secure web proxy (HTTPS) for HTTPS traffic. With most commercial proxies, use the same HTTP proxy host and port here.
    • SOCKS proxy for SOCKS.
  5. Enter the server and port. If the proxy needs credentials, enable Proxy server requires password and enter them.
  6. Add hosts to Bypass proxy settings for these hosts & domains if needed.
  7. Click OK.

On older macOS versions the path is System Preferences → Network → Advanced… → Proxies.

Automatic proxy configuration (PAC)

In the same Proxies panel, enable Automatic proxy configuration and enter the PAC URL. See proxy PAC files.

Command line: networksetup

networksetup configures the same settings from Terminal:

bash
networksetup -listallnetworkservices
networksetup -setwebproxy "Wi-Fi" gate.example.com 7777 on USER PASS
networksetup -setsecurewebproxy "Wi-Fi" gate.example.com 7777 on USER PASS
networksetup -setsocksfirewallproxy "Wi-Fi" socks.example.com 1080
networksetup -setproxybypassdomains "Wi-Fi" localhost 127.0.0.1 "*.local"
networksetup -getwebproxy "Wi-Fi"
networksetup -setwebproxystate "Wi-Fi" off
networksetup -setsecurewebproxystate "Wi-Fi" off

These commands may need administrator privileges.

Which apps use the macOS proxy?

  • Safari and Chrome use system proxy settings.
  • Firefox has its own settings but can use the system ones. See browser proxy settings.
  • Many apps respect system settings; some don't.
  • Terminal tools use environment variables.

Terminal environment variables

bash
export https_proxy="http://USER:PASS@gate.example.com:7777"
export http_proxy="$https_proxy"
export no_proxy="localhost,127.0.0.1"
curl https://api.ipify.org

Add them to ~/.zshrc to make them persistent. See curl proxy.

Verify

Check your IP in a browser or with curl https://api.ipify.org. See how to check if a proxy works.

Proxy tip: If you need a working proxy to test these steps with, Geonode generates endpoints in host:port:username:password format, supports IP whitelisting, and has a Chrome extension for quick switching. See using Geonode in your browser.

Troubleshooting

ProblemFix
Proxy ignoredConfigure the active network service (Wi-Fi vs Ethernet)
Password promptsEnable "requires password" and save credentials, or use IP whitelisting
Local devices unreachableAdd them to the bypass list
Terminal ignores system proxySet environment variables

See common proxy errors.

Per-app proxies on macOS

If you only want certain apps to use a proxy, avoid system settings and configure apps directly:

  • Firefox: its own Network Settings. See browser proxy settings.
  • Chrome: launch with --proxy-server and a separate profile.
  • Terminal tools: environment variables in that shell only.
  • Developer tools: many (git, npm, pip) have their own proxy configuration.

Examples:

bash
git config --global http.proxy http://USER:PASS@gate.example.com:7777
npm config set proxy http://USER:PASS@gate.example.com:7777
npm config set https-proxy http://USER:PASS@gate.example.com:7777
pip install --proxy http://USER:PASS@gate.example.com:7777 requests

Remove them when you're done (git config --global --unset http.proxy, npm config delete proxy).

Switching quickly between proxy setups

macOS Locations (in older macOS versions, under Network) let you save different network configurations, for example "Office" with a corporate proxy and "Home" without. In newer macOS versions, networksetup scripts or third-party tools can toggle settings quickly:

bash
#!/bin/zsh
# proxy-on.sh
networksetup -setwebproxy "Wi-Fi" gate.example.com 7777 on USER PASS
networksetup -setsecurewebproxy "Wi-Fi" gate.example.com 7777 on USER PASS
bash
#!/bin/zsh
# proxy-off.sh
networksetup -setwebproxystate "Wi-Fi" off
networksetup -setsecurewebproxystate "Wi-Fi" off

Verifying which apps use the proxy

Run curl https://api.ipify.org in Terminal (uses env vars, not system settings), then check your IP in Safari (uses system settings). Different results tell you which layer is configured. See how to check if a proxy works.

Common macOS gotchas

IssueExplanation
Proxy works on Wi-Fi, not EthernetSettings are per network service
Some apps ignore the proxyThey don't read system settings
Credentials prompts in every appSome apps don't use the saved password
Local services breakAdd them to the bypass list
VPN apps override proxy settingsDisconnect the VPN or configure it to allow the proxy

For Windows instructions, see proxy setup on Windows.

Using a SOCKS5 proxy system-wide on macOS

The SOCKS proxy setting in macOS applies to apps that honour system SOCKS settings. For a quick SOCKS5 proxy through your own server:

bash
ssh -N -D 1080 user@your-server
networksetup -setsocksfirewallproxy "Wi-Fi" 127.0.0.1 1080

Turn it off with networksetup -setsocksfirewallproxystate "Wi-Fi" off. See SOCKS5 proxies and self-hosted Squid proxy.

Checking what macOS is actually using

System Settings shows the configuration for each network service, but it's not always obvious which one is in effect. scutil prints the proxy configuration macOS is actually applying right now:

bash
scutil --proxy

Look for HTTPEnable, HTTPSEnable and SOCKSEnable (1 means on), the matching proxy host and port entries, ProxyAutoConfigURLString if a PAC file is set, and ExceptionsList for bypassed hosts.

Common surprises this reveals:

  • The wrong network service. Proxy settings are per service. If you configured Wi-Fi but you're on Ethernet or a USB adapter, nothing applies.
  • A PAC file you forgot about, which overrides what you expected.
  • A configuration profile. On managed Macs, a device management profile can set proxies. Check the Device Management or Profiles section of System Settings.
  • Terminal variables. scutil shows system settings only; run env | grep -i proxy to see what command-line tools will use.

Apple's guide to changing proxy settings on Mac covers the System Settings side. For the bigger picture of which apps honour the system proxy, see the sections above, and for browsers in particular, browser proxy settings. If you're comparing behaviour with a Windows machine, see proxy setup on Windows.

Key takeaways

  • macOS proxy settings are per network service (Wi-Fi, Ethernet), under System Settings → Network → Details → Proxies.
  • Web, Secure Web and SOCKS proxies are configured separately; most commercial proxies use the same HTTP host and port for both web fields.
  • networksetup scripts let you switch proxies on and off from Terminal.
  • Terminal tools use environment variables, not system settings.
  • For per-app proxying, configure Firefox, Chrome flags, git, npm or pip individually. See browser proxy settings.

FAQ

Does macOS support SOCKS5?

Yes, via the SOCKS proxy setting. Authentication support varies by app.

How do I disable the proxy?

Untick the proxy protocols in Network → Details → Proxies, or use networksetup -set...state off.

Affiliate disclosure: Team of Monkeys is a Geonode affiliate. Links and banners marked as sponsored, and links to Geonode in the text, use our referral link, and we may earn a commission if you buy through them, at no extra cost to you. Our explanations and comparisons are written to be useful whichever provider you choose.

Editorial note: Proxy providers change their pools, features and prices often, so treat any figures here as typical ranges at the time of writing and confirm current terms with the provider before you buy.