2025 macOS Proxy Setup Guide (System Proxy + Terminal Proxy)
Complete 2025 macOS proxy setup guide covering system preferences proxy settings, terminal export commands, and tool-level configuration.
When to Use This
In 2025, macOS is the mainstream operating system for Mac computers. Setting up a proxy on macOS is a frequent requirement: routing traffic through a corporate proxy on the office network, using proxy IPs for data collection and web scraping, or managing multiple store accounts with different IPs in cross-border e-commerce.
macOS proxy configuration operates at two independent levels. System-level proxy settings affect GUI applications such as Safari, Chrome, and Mail. Terminal-level proxy settings affect command-line tools such as curl, git, and npm. This guide covers both approaches.
Prerequisites
Before you begin, confirm the following proxy information is ready:
| Item | Description | Example |
|---|---|---|
| Proxy server address | IP address or domain name | proxy.16yun.cn |
| Port number | HTTP proxy commonly uses 8888, SOCKS5 uses 1080 | 8888 |
| Username | For proxy authentication (leave blank if not required) | your-username |
| Password | For proxy authentication | your-password |
| Proxy type | HTTP / HTTPS / SOCKS5 | HTTP |
Method 1: System Proxy Settings (GUI)
System proxy settings affect most GUI applications, including Safari, Chrome, Mail, and other network-aware Mac apps.
Step 1: Open System Settings Click the Apple menu in the top-left corner and select System Settings. You can also click the System Settings icon in the Dock.
Step 2: Navigate to Network In System Settings, locate and click Network. The Network settings are listed in the sidebar.
Step 3: Select Your Network Connection Choose the network connection you are currently using. There are two options: WiFi (wireless) or Ethernet (wired). Select the active one.
Step 4: Open Proxy Settings Click the Details button (or Advanced on older macOS versions), then select the Proxies tab.
Step 5: Select Proxy Protocols macOS supports multiple proxy protocols. Check the ones you need:
- Web Proxy (HTTP): For HTTP traffic
- Secure Web Proxy (HTTPS): For HTTPS traffic
- SOCKS Proxy: For SOCKS traffic (if required)
Typically, check both Web Proxy (HTTP) and Secure Web Proxy (HTTPS), entering the same proxy address and port for both.
Step 6: Enter Proxy Information Fill in the proxy server address and port number. If the proxy requires authentication, check Proxy server requires password and enter your credentials.
Step 7: Apply Settings Click OK to close the detail window, then click Apply for the settings to take effect.
Verification
Open Safari and visit httpbin.org/ip. If the page shows your proxy IP address, the configuration is successful.
Method 2: Terminal Proxy (CLI)
If you use command-line tools in the terminal (curl, wget, git, npm, etc.), you need to configure terminal proxy separately. Terminal proxy does not follow system proxy settings.
Temporary Setup (current session only):
export http_proxy=http://proxy.16yun.cn:8888
export https_proxy=http://proxy.16yun.cn:8888
export HTTP_PROXY=http://proxy.16yun.cn:8888
export HTTPS_PROXY=http://proxy.16yun.cn:8888Run these commands in the terminal. The proxy applies only to the current terminal window. Close the terminal or open a new window and the settings are lost.
Permanent Setup (recommended):
Add the following lines to your shell profile (~/.zshrc for zsh on macOS, or ~/.bashrc for bash):
# Proxy settings
export http_proxy=http://proxy.16yun.cn:8888
export https_proxy=http://proxy.16yun.cn:8888
export HTTP_PROXY=http://proxy.16yun.cn:8888
export HTTPS_PROXY=http://proxy.16yun.cn:8888
# Bypass proxy for local addresses
export no_proxy=localhost,127.0.0.1,10.*After adding the lines, run source ~/.zshrc to apply the changes immediately.
SOCKS5 Proxy Configuration:
If you are using a SOCKS5 proxy, set the environment variable differently:
export ALL_PROXY=socks5://proxy.16yun.cn:1080
export all_proxy=socks5://proxy.16yun.cn:1080Tool-Level Configuration
Some tools support independent proxy settings alongside environment variables:
Git:
git config --global http.proxy http://proxy.16yun.cn:8888
git config --global https.proxy http://proxy.16yun.cn:8888
git config --global --unset http.proxy # Remove proxynpm:
npm config set proxy http://proxy.16yun.cn:8888
npm config set https-proxy http://proxy.16yun.cn:8888
npm config delete proxy # Remove proxycurl:
curl -x http://proxy.16yun.cn:8888 https://httpbin.org/ipCommon Issues
Issue 1: Safari and Chrome use the proxy but terminal tools do not
macOS system proxy settings apply only to GUI applications. Terminal tools require the export commands described in Method 2. If you run curl, git, or npm through the terminal and need them to use a proxy, run the export commands or add them to your shell profile.
Issue 2: Some apps bypass the system proxy
macOS system proxy only affects applications that respect system proxy settings. Some third-party applications ignore them. For truly global proxy coverage, install a proxy client like Proxifier.
Issue 3: Terminal proxy is set but does not take effect
Verify the proxy address and port in the export commands. Pay attention to the difference between http_proxy (HTTP requests) and https_proxy (HTTPS requests). Many programs only recognize lowercase variants, so set both lowercase and uppercase. After setting, confirm with echo $http_proxy.
Configuration Method Comparison
| Method | Scope | Advantage | Disadvantage |
|---|---|---|---|
| System proxy (GUI) | GUI applications | One-time setup, Safari/Chrome auto-config | Does not affect terminal tools |
| Terminal export | Current terminal | Command-line tools use proxy automatically | Must re-set for each new terminal |
| Shell profile | All terminals | Permanent, no repeat configuration | Requires editing a config file |
| Tool-level config | Single tool | Does not affect other tools | Must configure each tool individually |
Important Notes
- System proxy and terminal proxy are independent and must be configured separately
- Back up your shell profile before editing it to avoid configuration errors
- Always set
no_proxyso that local addresses bypass the proxy - SOCKS5 proxy on macOS requires tool-level configuration or a dedicated proxy client
- Disable proxy in System Settings or unset environment variables when proxy is no longer needed
- If the proxy server disconnects unexpectedly, disable the system proxy in Network settings or run
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXYin the terminal to restore direct connectivity
Proxy Script Automation
If you frequently switch between proxy configurations, add these functions to your ~/.zshrc for quick toggling:
# Enable proxy
function proxy_on() {
export http_proxy=http://proxy.16yun.cn:8888
export https_proxy=http://proxy.16yun.cn:8888
export HTTP_PROXY=http://proxy.16yun.cn:8888
export HTTPS_PROXY=http://proxy.16yun.cn:8888
echo "Proxy enabled"
}
# Disable proxy
function proxy_off() {
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY
echo "Proxy disabled"
}After adding the functions, run source ~/.zshrc, then use proxy_on or proxy_off in the terminal for instant switching.
macOS Version Differences
| macOS Version | Settings Entry | Notes |
|---|---|---|
| macOS 10.15 (Catalina) | System Preferences, Network, Advanced, Proxies | Classic interface |
| macOS 11-12 (Big Sur / Monterey) | System Preferences, Network, Advanced, Proxies | Slightly adjusted UI |
| macOS 13+ (Ventura and later) | System Settings, Network, Details, Proxies | Newer Settings interface |
The core configuration options and the way you enter proxy information remain the same across all versions. If your version differs from the example, follow the corresponding navigation path.
Security Tips
- Avoid using unencrypted HTTP proxies on public WiFi networks
- Prefer proxies with username and password authentication over open (anonymous) proxies
- After setting terminal proxy, avoid running commands that involve sensitive information in the same session
- Regularly review your
no_proxysettings to ensure local traffic does not accidentally route through the proxy - Clear environment variables with
unsetor disable system proxy when it is no longer needed
Related Guides
- Android proxy setup guide (2025)
- Windows system proxy setup guide (2025)
- Linux terminal proxy setup guide (2025)
Need an enterprise proxy plan?
We can tailor architecture to your target domains, concurrency, and reliability goals.