Skip to content

Instantly share code, notes, and snippets.

@AidenMontgomery
Created July 28, 2016 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AidenMontgomery/8554b6f32fb0368b6cf27aa876caa9ac to your computer and use it in GitHub Desktop.
Save AidenMontgomery/8554b6f32fb0368b6cf27aa876caa9ac to your computer and use it in GitHub Desktop.
Update all network interfaces to use the specified proxy settings.
proxy_hostname=localhost
proxy_port=5050
nics=$(networksetup -listnetworkserviceorder | awk '/\([0-9]\)/ {print $2"_"$3}')
for nic in $nics; do
nic="${nic/_/ }"
nic=$(echo "${nic}" | awk '{gsub(/^ +| +$/,"")} {print $0}')
sudo networksetup -setwebproxy "$nic" $proxy_hostname $proxy_port
sudo networksetup -setsecurewebproxy "$nic" $proxy_hostname $proxy_port
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment