Skip to content

Instantly share code, notes, and snippets.

@mrbuk
Last active May 29, 2016 18:15
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 mrbuk/b0cfa31bb73e63720e335cbe46e04720 to your computer and use it in GitHub Desktop.
Save mrbuk/b0cfa31bb73e63720e335cbe46e04720 to your computer and use it in GitHub Desktop.
Refresh PAC by disabling/enabling proxy state
#! /bin/sh
read -r -d '' script << _EOF_
networksetup -listallnetworkservices | awk 'NR>1' | while read SERVICE ; do
if networksetup -getautoproxyurl "\$SERVICE" | grep '^Enabled: Yes' >/dev/null; then
networksetup -setautoproxystate "\$SERVICE" off
networksetup -setautoproxystate "\$SERVICE" on
echo "\$SERVICE" bounced.
fi
done
_EOF_
echo "$script" | sudo sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment