Last active
June 7, 2019 04:08
-
-
Save jeremysu0131/af4951dc033382a7ec47495718dac940 to your computer and use it in GitHub Desktop.
Put the following code in your .bashrc or .zshrc then use set_proxy and unset_proxy to set/unset your Mac's proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set_proxy(){ | |
# This set web proxy (http) | |
# networksetup -setwebproxy <networkservice> <domain> <port number> <authenticated> <username> <password> | |
sudo networksetup -setwebproxy "Wi-Fi" 127.0.0.1 3000 | |
# This set secure web proxy (https) | |
# networksetup -setsecurewebproxy <networkservice> <domain> <port number> <authenticated> <username> <password> | |
sudo networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 3000 | |
echo "Proxy enabled." | |
} | |
unset_proxy(){ | |
# networksetup -setwebproxystate <networkservice> <on off> | |
sudo networksetup -setwebproxystate "Wi-Fi" off | |
sudo networksetup -setsecurewebproxystate "Wi-Fi" off | |
echo "Proxy disabled." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment