How to Configure Proxy Server Settings on macOS
Step-by-step guide to setting up proxies on macOS via System Settings, PAC files, and terminal environment variables, including verification and troubleshooting.
Understanding Proxy Configuration on macOS
macOS provides several ways to route network traffic through a proxy server, from graphical system settings to terminal environment variables. This guide walks through each method, offering practical examples and honest caveats about security and compatibility.
Accessing Proxy Settings via System Settings
On modern versions of macOS (Ventura and later), open System Settings, go to Network, select your active network service (Wi‑Fi or Ethernet), and click Details then Proxies. Earlier versions use System Preferences > Network > Advanced > Proxies.
Configuring HTTP, HTTPS and SOCKS Proxies
Within the Proxy settings panel, enable the protocol you want to use. For a basic HTTP/HTTPS proxy, check Web Proxy (HTTP) and Secure Web Proxy (HTTPS). Enter the server address and port number (e.g., proxy.example.com port 8080). SOCKS proxy settings are under SOCKS Proxy.
- HTTP proxy – handles plain web traffic. Always enable this if your proxy supports HTTP.
- HTTPS proxy – used for encrypted web traffic. Some proxies use the same address and port for both.
- SOCKS proxy – versatile protocol for many applications beyond the browser. SOCKS5 can also forward DNS.
If you’re using a free proxy list, ensure the entries match the required protocol. Many free proxies only support HTTP, which means HTTPS sites will fail unless you also configure HTTPS proxy settings.
Per‑Network Proxy Configuration
macOS stores proxy settings per network service (Wi‑Fi, Ethernet, VPN). For example, you might want a proxy only when on a corporate Wi‑Fi network. Simply set the proxy on that specific service; other services remain unaffected. This is useful if you travel with a laptop and need different proxies in different locations.
Automatic Proxy Configuration (PAC)
Check Automatic Proxy Configuration and enter a URL to a PAC file (e.g., http://proxy.config/pac.js). The PAC file is a JavaScript function that tells the system which proxy to use for a given URL. Example:
function FindProxyForURL(url, host) {
if (shExpMatch(host, '*.example.com')) {
return 'PROXY proxy.example.com:8080';
}
return 'DIRECT';
}PAC files offer flexible routing but can introduce latency if the server is slow. Use them only when genuinely needed.
Authenticated Proxies
If your proxy requires a username and password, macOS will prompt for credentials when the system first tries to use the proxy. To avoid repeated prompts, you can store credentials in the keychain. Alternatively, some proxies accept credentials in the format username:password@proxy.example.com:port when entered in the proxy settings, but this is not recommended as it stores them in plain text in system configurations.
For authenticated proxies, consider using an authentication proxy tool or a local PAC file that includes credentials only for specific traffic, but never hardcode passwords in scripts or environment variables.
Setting Proxy Environment Variables in the Terminal
Many command-line tools respect environment variables for proxy configuration. Add the following to your ~/.zshrc or ~/.bash_profile:
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
export NO_PROXY=localhost,127.0.0.1,::1For SOCKS, use ALL_PROXY=socks5://proxy.example.com:1080. Note that some tools use lower‑case variables (http_proxy) and others upper‑case; it’s safest to set both. After editing, run source ~/.zshrc to apply changes.
Verifying Your Proxy Works
After configuring a proxy, check that your IP address appears as the proxy’s IP. Visit What is my IP on ProxyVerity – it shows the IP seen from the internet. If it matches your proxy server, traffic is being routed correctly. For deeper testing, use a proxy checker to verify anonymity, speed, and protocol support.
Troubleshooting Common Issues
- HTTPS sites fail – Ensure you configured the HTTPS proxy as well; many free proxies do not support CONNECT for HTTPS.
- No internet after enabling proxy – The proxy may be unreachable. Check the server address and port, or disable the proxy to test connectivity.
- Terminal commands not using proxy – Not all applications respect system proxy settings. Set environment variables as shown above, or use tools like
proxychains. - Authentication prompts keep appearing – Save credentials to keychain or investigate if the proxy is using NTLM or other challenging auth methods.
Security and Honest Caveats
Public proxies from free lists are often unreliable and may log your traffic. Never send sensitive data (passwords, credit cards) through an untrusted proxy. If using a proxy for privacy, ensure it supports HTTPS forwarding and verify it doesn't inject headers. Always check the proxy’s anonymity level with a service like ProxyVerity’s checker. And respect robots.txt and terms of service when scraping with proxies.