Configure a SOCKS Proxy with networksetup -setsocksfirewallproxy

Enable or disable a system-wide SOCKS firewall proxy for a network service from the command line.

macOSproxynetworksetupsocksMedium risk
Run `sudo networksetup -setsocksfirewallproxy <service> <host> <port>` to enable a SOCKS5 proxy, and inspect it with `networksetup -getsocksfirewallproxy <service>`.

01Command

Command
$ sudo networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 1080
networksetup -getsocksfirewallproxy Wi-Fi

02What it does

Despite the old name, `-setsocksfirewallproxy` is exactly how System Settings fills the SOCKS proxy pane. A common use is pointing it at `127.0.0.1 1080` while an `ssh -D 1080` tunnel is running, so browsers and system services route through the tunnel. To turn it off cleanly, set the domain to a blank/space value and port 0 — or untoggle via `-setsocksfirewallproxystate <service> off`.

03Risk

RiskMedium risk
!Warning: The proxy is enabled only while the tunnel process is alive; with no listener on that port, traffic that respects the system proxy will fail to connect.

04Undo

Undo
$ sudo networksetup -setsocksfirewallproxy Wi-Fi " " 0

05Sources

Last verified: 2026-09-17 · Category: Network