How to Set Up a Proxy on macOS Sequoia and Sonoma
Configuring a proxy on macOS is a critical skill for professionals working with data collection, account management, or any task that requires routing internet traffic through an intermediary server. Apple’s macOS provides built-in proxy support through System Settings, and power users can also configure proxies via the Terminal for more granular control.
This guide covers every method for setting up HTTP, HTTPS, and SOCKS5 proxies on macOS Sequoia (macOS 15) and macOS Sonoma (macOS 14), along with troubleshooting tips and best practices.
Why Configure a Proxy on macOS
A proxy server routes your internet traffic through a different IP address before reaching its destination. This is essential for:
- Data collection and web scraping — Route requests through different IPs to avoid rate limiting. Learn more in our web scraping proxy guide.
- Privacy and anonymity — Hide your real IP address from websites
- Geo-testing — Access content as if you were in a different country
- Network security — Route traffic through a secure gateway in corporate environments
- Multi-account management — Assign different IPs to different workflows
Method 1: Configure a Proxy via System Settings (GUI)
This method applies a system-wide proxy that most macOS applications will respect, including Safari, Mail, and other apps that use the system network stack.
Step 1: Open Network Settings
- Click the Apple menu in the top-left corner and select System Settings (on Sonoma or Sequoia).
- Click Network in the left sidebar.
- Select your active network connection (e.g., Wi-Fi or Ethernet).
- Click Details next to your connected network.
Step 2: Navigate to Proxy Settings
- In the network details window, click Proxies in the left sidebar.
Step 3: Configure Your Proxy Type
macOS supports several proxy types. Enable the one that matches your proxy provider’s configuration:
For HTTP Proxy (Web Proxy):
- Toggle Web Proxy (HTTP) to On.
- Enter the Server address (e.g.,
proxy.example.com). - Enter the Port (e.g.,
8080). - If authentication is required, check Proxy server requires password and enter your Username and Password.
For HTTPS Proxy (Secure Web Proxy):
- Toggle Secure Web Proxy (HTTPS) to On.
- Enter the same server address and port details.
- Enter credentials if required.
For SOCKS5 Proxy:
- Toggle SOCKS Proxy to On.
- Enter the server address and port (typically
1080for SOCKS5). - Enter credentials if required.
Step 4: Configure Bypass Domains
In the Bypass proxy settings for these Hosts & Domains field, add any domains or IP addresses that should bypass the proxy. Common entries include:
*.local, 169.254/16, localhost, 127.0.0.1Step 5: Apply Settings
Click OK to save the proxy configuration. The changes take effect immediately for most applications.
Step 6: Verify the Configuration
Open Safari and visit whatismyipaddress.com. The displayed IP should match your proxy server’s IP address.
Method 2: Configure a Proxy via Terminal (networksetup)
The networksetup command-line utility provides full control over network settings, including proxy configuration. This method is ideal for automation and scripting.
Identify Your Network Service Name
First, determine the name of your active network service:
networksetup -listallnetworkservicesThis returns something like:
An asterisk (*) denotes that a network service is disabled.
Wi-Fi
Ethernet
Thunderbolt BridgeUse the appropriate service name (e.g., Wi-Fi) in the commands below.
Configure HTTP Proxy
# Enable and set HTTP proxy
networksetup -setwebproxy "Wi-Fi" proxy.example.com 8080
# With authentication
networksetup -setwebproxy "Wi-Fi" proxy.example.com 8080 on username passwordConfigure HTTPS Proxy
# Enable and set HTTPS proxy
networksetup -setsecurewebproxy "Wi-Fi" proxy.example.com 8443
# With authentication
networksetup -setsecurewebproxy "Wi-Fi" proxy.example.com 8443 on username passwordConfigure SOCKS5 Proxy
# Enable and set SOCKS proxy
networksetup -setsocksfirewallproxy "Wi-Fi" proxy.example.com 1080
# With authentication
networksetup -setsocksfirewallproxy "Wi-Fi" proxy.example.com 1080 on username passwordSet Bypass Domains
networksetup -setproxybypassdomains "Wi-Fi" "*.local" "169.254/16" "localhost" "127.0.0.1"Verify Proxy Settings
# Check HTTP proxy
networksetup -getwebproxy "Wi-Fi"
# Check HTTPS proxy
networksetup -getsecurewebproxy "Wi-Fi"
# Check SOCKS proxy
networksetup -getsocksfirewallproxy "Wi-Fi"Disable Proxies
networksetup -setwebproxystate "Wi-Fi" off
networksetup -setsecurewebproxystate "Wi-Fi" off
networksetup -setsocksfirewallproxystate "Wi-Fi" offMethod 3: Set Environment Variables for CLI Tools
Many command-line tools on macOS (such as curl, wget, brew, and programming language package managers) use environment variables for proxy configuration.
Temporary (Current Terminal Session)
export http_proxy="http://username:password@proxy.example.com:8080"
export https_proxy="http://username:password@proxy.example.com:8080"
export no_proxy="localhost,127.0.0.1,.local"Permanent (Add to Shell Profile)
Add the above export commands to your shell configuration file:
For zsh (default on macOS):
echo 'export http_proxy="http://proxy.example.com:8080"' >> ~/.zshrc
echo 'export https_proxy="http://proxy.example.com:8080"' >> ~/.zshrc
source ~/.zshrcFor bash:
echo 'export http_proxy="http://proxy.example.com:8080"' >> ~/.bash_profile
echo 'export https_proxy="http://proxy.example.com:8080"' >> ~/.bash_profile
source ~/.bash_profileMethod 4: Use a PAC File on macOS
Proxy Auto-Configuration (PAC) files allow you to define conditional proxy rules, which is useful when you only want certain traffic routed through the proxy.
Step 1: Create a PAC File
Create a file named proxy.pac:
function FindProxyForURL(url, host) {
if (shExpMatch(host, "*.local") || host === "localhost") {
return "DIRECT";
}
if (shExpMatch(host, "*.target-site.com")) {
return "PROXY proxy.example.com:8080";
}
return "DIRECT";
}Step 2: Configure macOS to Use the PAC File
Via System Settings:
- Go to System Settings > Network > Wi-Fi > Details > Proxies.
- Toggle Automatic Proxy Configuration to On.
- Enter the URL to your PAC file (e.g.,
file:///Users/yourname/proxy.pac).
Via Terminal:
networksetup -setautoproxyurl "Wi-Fi" "file:///Users/yourname/proxy.pac"Configuring Proxy for Specific macOS Applications
Safari
Safari uses the system proxy settings by default. Any proxy configured in System Settings will automatically apply to Safari.
Terminal Applications (curl, wget)
Use environment variables as shown in Method 3 above. You can also pass proxy settings inline:
curl -x http://proxy.example.com:8080 https://api.ipify.org
curl --socks5 proxy.example.com:1080 https://api.ipify.orgHomebrew
Homebrew respects the standard http_proxy and https_proxy environment variables. Set them before running brew commands:
export ALL_PROXY="http://proxy.example.com:8080"
brew install package-nameTroubleshooting macOS Proxy Issues
Proxy Not Taking Effect
- Restart the application — Some apps cache network settings on launch.
- Check the correct network interface — Ensure you configured the proxy on the active connection (Wi-Fi vs. Ethernet).
- Flush DNS cache:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Authentication Errors
- Verify your credentials are correct.
- Special characters in passwords must be URL-encoded in environment variables (e.g.,
@becomes%40). - Some proxies use IP-based authentication instead of username/password. Ensure your IP is whitelisted.
Slow Performance
Free or overloaded proxies often cause slow connections. For reliable performance, consider using a premium mobile proxy service that provides dedicated bandwidth and low latency.
Apps Ignoring System Proxy
Some applications (like certain VPN clients, Docker, or Electron-based apps) have their own proxy settings and ignore the system configuration. Check the application’s preferences or documentation.
Best Practices
- Use SOCKS5 proxies for maximum compatibility and protocol support. For a deeper dive into proxy protocols, visit our proxy glossary.
- Script your proxy setup using
networksetupcommands if you frequently switch between proxy configurations. - Create a shell function to quickly toggle proxies on and off:
proxy_on() {
networksetup -setwebproxy "Wi-Fi" "$1" "$2"
networksetup -setsecurewebproxy "Wi-Fi" "$1" "$2"
echo "Proxy enabled: $1:$2"
}
proxy_off() {
networksetup -setwebproxystate "Wi-Fi" off
networksetup -setsecurewebproxystate "Wi-Fi" off
echo "Proxy disabled"
}- Verify your proxy after every configuration change by checking your public IP.
- Keep your macOS updated to ensure you have the latest security patches and network features.
Conclusion
macOS provides robust proxy support through both System Settings and Terminal commands. For most users, the GUI method in System Settings is sufficient. Developers and automation-focused users will benefit from the networksetup command and environment variables, which enable scripted proxy management across multiple configurations. Whatever method you choose, always verify your proxy is active by confirming your public IP address has changed.
- How to Configure a Proxy in FoxyProxy for Firefox
- How to Configure a Proxy on iPhone and iPad (iOS 18)
- Backconnect Proxies Deep Dive: Architecture and Real-World Performance
- Best Proxies in Southeast Asia: Singapore, Thailand, Indonesia, Philippines
- How to Build a 4G/5G Mobile Proxy Farm with Raspberry Pi
- Common cURL and Python Requests Proxy Errors (With Code Fixes)
- How to Configure a Proxy in FoxyProxy for Firefox
- How to Configure a Proxy on iPhone and iPad (iOS 18)
- Anti-Bot Detection Glossary: 50+ Terms Defined
- Anti-Bot Terminology Glossary: Complete A-Z Reference 2026
- Backconnect Proxies Deep Dive: Architecture and Real-World Performance
- Best Proxies in Southeast Asia: Singapore, Thailand, Indonesia, Philippines
- How to Configure a Proxy in FoxyProxy for Firefox
- How to Configure a Proxy on iPhone and iPad (iOS 18)
- 403 Forbidden Error: What It Means & How to Fix It
- 407 Proxy Authentication Required: Fix Guide
- Anti-Bot Detection Glossary: 50+ Terms Defined
- Anti-Bot Terminology Glossary: Complete A-Z Reference 2026