macOS Terminal – How to Add a Proxy

macosterminal

How would I add and activate a proxy for my computer via terminal (without going into System Preferences.) Can I do that with scutil --proxy somehow?

Best Answer

You can use networksetup.

See man networksetup for a full list.

Run this command via terminal.app

Example: setting http proxies.

sudo networksetup -setwebproxy Wi-Fi proxy.yourdomain 9090

sudo networksetup -setproxybypassdomains Wi-Fi website1, website2, website3

Replace Wi-Fi with the approiate service name (wifi, ethernet, ..).