Set or Clear an HTTP Web Proxy
Configure the macOS web (HTTP) proxy for a network service from the terminal with networksetup -setwebproxy.
Run `networksetup -setwebproxy "Wi-Fi" <proxy-address> <port>` then `-setwebproxystate "Wi-Fi" on`; turn it off again with `-setwebproxystate "Wi-Fi" off`.
01Command
Command
$ networksetup -setwebproxy "Wi-Fi" 127.0.0.1 8118 && networksetup -setwebproxystate "Wi-Fi" on02What it does
This sets the same 'Web Proxy (HTTP)' fields as System Settings > Network > Details > Proxies, per network service — so Wi-Fi and Ethernet can have different settings. Browsers that use system settings (Safari, and Chrome by default) pick it up immediately. A wrong proxy address makes all web traffic fail with connection errors, so remember the off switch in undoCommand.
03Risk
!Warning: A mistyped proxy address will break all web browsing on that service — if pages stop loading, turn the proxy state off again.
04Undo
Undo
$ networksetup -setwebproxystate "Wi-Fi" off05Sources
- networksetup — configure network settings (macOS man page)Evidence: Documents `networksetup -setwebproxy <service> <domain> <port>` and `-setwebproxystate on|off` to enable or disable the HTTP web proxy.
Last verified: 2026-09-18 · Category: Network