Last active
January 27, 2018 16:34
-
-
Save slumos/6acfb52bb27728218db2 to your computer and use it in GitHub Desktop.
flush dns cache for different versions of OSX.
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
#! /bin/sh | |
# super-simplified version of flushDNSCache from Tunnelblick | |
osx_version=$(/usr/bin/sw_vers | awk '/ProductVersion:/ {print $2}') | |
echo "OSX: ${osx_version}" | |
case "${osx_version}" in | |
10.9.*|10.11.*) | |
sudo /usr/bin/dscacheutil -flushcache | |
sudo /usr/bin/pkill -HUP mDNSResponder | |
;; | |
10.[78].*) | |
sudo /usr/bin/pkill -HUP mDNSResponder | |
;; | |
10.[56].*) | |
sudo dscacheutil -flushcache | |
;; | |
10.10.*) | |
sudo discoveryutil udnsflushcaches | |
;; | |
*) | |
echo "don't know how. sorries..." | |
exit | |
esac | |
echo "flushed..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment