Skip to content

Instantly share code, notes, and snippets.

@animatedlew
Created November 6, 2023 19:07
Show Gist options
  • Save animatedlew/11c0743c7da69c8e1a3a448d523b3453 to your computer and use it in GitHub Desktop.
Save animatedlew/11c0743c7da69c8e1a3a448d523b3453 to your computer and use it in GitHub Desktop.
AppleScript that points DNS settings to Google.
set var to "Do you want to point your DNS to Google servers?"
set question to display dialog var buttons {"Update DNS", "Quit"} giving up after 5
set answer to button returned of question
if answer is "Update DNS" then
do shell script "networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4" with administrator privileges
delay 3
do shell script "dscacheutil -flushcache" with administrator privileges
display dialog "Your DNS now points to Google servers." buttons {"Bye!"}
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment