In OS X, you turn on and off a web proxy from System Preferences > Network > Proxies, by checking Web Proxy (HTTP) and designating the Web Proxy Server etc. and by clicking OK a
I prepared a script named proxy that might help,
#!/bin/bash
#
#
# Author: Md. Sazzad Hissain Khan
# Date: 8 July, 2017
#
#
NETWORK_SERVICE_NAME="Ethernet"
if [ "$#" -ne 1 ]; then
echo "Argument missing [on/off]"
exit 0
fi
if [ $1 == "on" ]; then
echo "Enabling secure proxy for $NETWORK_SERVICE_NAME"
networksetup -setsecurewebproxystate "$NETWORK_SERVICE_NAME" on
elif [ $1 == "off" ]; then
echo "Disabling secure proxy for $NETWORK_SERVICE_NAME"
networksetup -setsecurewebproxystate "$NETWORK_SERVICE_NAME" off
else
echo "Argument invalid [permitted:on/off]"
fi
NETWORK_SERVICE_NAME
is the name of your active network which you need to configure.
proxy
file in /usr/local/bin.
proxy.
sudo chmod 777 proxy
. How to use:
proxy on
proxy off