Skip to content

Instantly share code, notes, and snippets.

@supaket
Created June 11, 2017 10:28
Show Gist options
  • Save supaket/6e95ffa73813310966c1802244260cda to your computer and use it in GitHub Desktop.
Save supaket/6e95ffa73813310966c1802244260cda to your computer and use it in GitHub Desktop.
Set Wi-Fi system wide proxy on Mac OS X
#!/bin/sh
# if no args prints http and https proxy info
if [ -z "$1" ]; then
echo " Wi-Fi HTTP PROXY:"
networksetup -getwebproxy "Wi-Fi"
# if only one arg turns http and https proxy on/off
elif [ -n "$1" ] && [ -z "$2" ]; then
networksetup -setwebproxystate "Wi-Fi" $1
networksetup -setsecurewebproxystate "Wi-Fi" $1
# if wtwo args sets http and https proxy
elif [ -n "$1" ] && [ -n "$2" ]; then
networksetup -setwebproxy "Wi-Fi" $1 $2
networksetup -setsecurewebproxy "Wi-Fi" $1 $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment