Last active
May 7, 2017 16:43
-
-
Save arastu/1a54971c901ff01d372aae1e01e6a88b to your computer and use it in GitHub Desktop.
Shell function to set, on or off http and https 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
# add this function to .zshrc or .bashrc | |
# Example: | |
# Set http and https proxy: | |
# $ macsetproxy 127.0.0.1 8118 | |
# | |
# Turn http and https proxy off | |
# $ macoffproxy | |
# | |
# Turn http and https proxy on | |
# $ maconproxy | |
# | |
# If you want set, on or off proxy in other interface in your mac | |
# change "Wi-Fi" to appropriate interface | |
function macsetproxy() { | |
sudo networksetup -setwebproxy "Wi-Fi" $1 $2 | |
sudo networksetup -setsecurewebproxy "Wi-Fi" $1 $2 | |
} | |
function maconproxy() { | |
sudo networksetup -setwebproxystate "Wi-Fi" on | |
sudo networksetup -setsecurewebproxystate "Wi-Fi" on | |
} | |
function macoffproxy() { | |
sudo networksetup -setwebproxystate "Wi-Fi" off | |
sudo networksetup -setsecurewebproxystate "Wi-Fi" off | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment