Skip to content

Instantly share code, notes, and snippets.

@henter
Last active January 3, 2016 13:38
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 henter/8470345 to your computer and use it in GitHub Desktop.
Save henter/8470345 to your computer and use it in GitHub Desktop.
flush mac dnscache
#!/bin/bash
long=`sw_vers -productVersion`
short=${long:0:4}
if [ "$short" == "10.4" ]; then
lookupd -flushcache
elif [ "$short" == "10.5" ] || [ "$short" == "10.6" ]; then
dscacheutil -flushcache
elif [ "$short" == "10.7" ] || [ "$short" == "10.8" ]; then
sudo killall -HUP mDNSResponder
elif [ "$short" == "10.9" ]; then
dscacheutil -flushcache;
sudo killall -HUP mDNSResponder
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment