Last active
August 29, 2015 14:23
-
-
Save jordansaints/4a7c80b9293f7d7312ac to your computer and use it in GitHub Desktop.
OS X version-aware flushing of the DNS cache
This file contains hidden or 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
-- OS X version-aware flushing of the DNS cache | |
-- Intended for use in an Alfred Flush-DNS workflow | |
set os_version to do shell script "sw_vers -productVersion" | |
if os_version ≥ "10.3" and os_version < "10.5" then | |
do shell script "lookupd -flushcache" | |
else if os_version < "10.7" then | |
do shell script "dscacheutil -flushcache" | |
else if os_version < "10.9" then | |
do shell script "killall -HUP mDNSResponder" with administrator privileges | |
else if os_version < "10.10" then | |
do shell script "dscacheutil -flushcache" | |
do shell script "killall -HUP mDNSResponder" with administrator privileges | |
else if os_version ≥ "10.10" and os_version < "10.11" then | |
do shell script "discoveryutil mdnsflushcache" with administrator privileges | |
do shell script "discoveryutil udnsflushcaches" with administrator privileges | |
else | |
display dialog "This version of OS X is not supported" | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment