How to set up a proxy on Mac, Windows and the command line

Once you have the proxy host, port, username and password: how to enter them in system settings, browsers, the command line and scripts, and how to check it works.

Updated Nov 30, 2026

How to set up a proxy on Mac, Windows and the command line

01Get your connection details ready

You need four things: host (address), port, username and password, plus the protocol: HTTP(S) or SOCKS5. Many apps also accept them as a single line:

http://USER:PASS@HOST:PORT

socks5://USER:PASS@HOST:PORT

Replace USER, PASS, HOST and PORT with your own. With a NexMini static residential proxy, open an IP under Static residential proxy → My IPs in your console and copy it in either format with one click.

02On a Mac (system proxy)

  1. Open System Settings → Network, click the network you are using (Wi-Fi or Ethernet), then click Details….
  2. Choose Proxies on the left.
  3. For an HTTP proxy, turn on Web proxy (HTTP) and Secure web proxy (HTTPS), enter the host and port for both, turn on Proxy server requires password, and enter the username and password. For SOCKS5, turn on only SOCKS proxy and fill it in the same way.
  4. Click OK to save.

The system proxy only applies to apps that read system settings, such as Safari and most browsers. Terminal commands usually do not; set them up as described under “Command line and scripts”.

03On Windows

  1. Open Settings → Network & internet → Proxy.
  2. Next to Manual proxy setup, click Set up, turn on Use a proxy server, enter the address and port, and save.
  3. The first time your browser opens a page, it asks for the username and password. Enter them.

The Windows system proxy only supports HTTP. For SOCKS5, set it up in your browser or proxy app instead.

04Command line and scripts

Set environment variables in the terminal and most tools in that window, such as curl, git and Python, use the proxy:

export https_proxy="http://USER:PASS@HOST:PORT"

export http_proxy="http://USER:PASS@HOST:PORT"

  • curl can also take it directly: curl -x http://USER:PASS@HOST:PORT https://example.com. For SOCKS5, use socks5h:// so the proxy resolves domain names too.
  • For git only: git config --global http.proxy http://USER:PASS@HOST:PORT
  • Python’s requests reads the environment variables above automatically; you can also pass proxies in code.
  • The fetch built into Node.js does not read these variables by default. Configure the proxy in code instead, for example with undici’s ProxyAgent.

To keep it on, add both export lines to ~/.zshrc (Mac) or ~/.bashrc (Linux).

05Check that it works

Run this in a terminal. It should print the proxy’s IP, not your own:

curl -x http://USER:PASS@HOST:PORT https://api.ipify.org

In a browser, open any “what is my IP” site and check the address and location. With a broadcast IP, some sites may show a different country from the one you chose; that is expected.

06If it will not connect

  • Error 407 or repeated sign-in prompts: the username or password is wrong. Watch for extra spaces when copying.
  • Timeouts: check the host and port, then make sure your current network can reach servers abroad. Direct connections from mainland China are not guaranteed.
  • Only some apps use the proxy: the others do not read system settings and need their own proxy setting.
  • Passwords with symbols such as @ or : must be URL-encoded in the single-line format (for example, @ becomes %40), or enter the fields separately.