From 22afd8159652a414af4bd3485c2065acb996c5b4 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Tue, 15 Sep 2015 19:38:24 +0100 Subject: [PATCH] Change to a better Mac-friendly DNS flush method. --- bin/flush-dns | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/bin/flush-dns b/bin/flush-dns index 1d7a42f..56cdd58 100755 --- a/bin/flush-dns +++ b/bin/flush-dns @@ -11,13 +11,21 @@ function sorry() } case ${OS} in - Darwin) case ${REL} in - 14.*) sudo dscacheutil -flushcache - ;; - 13.*) sudo pkill mDNS - ;; - *) sorry - ;; + Darwin) PROD_VER=$(sw_vers -productVersion) + case ${PROD_VER} in + 10.10.3|\ + 10.10.2|\ + 10.10.1|\ + 10.10.0|\ + 10.10) sudo discoveryutil mdnsflushcache + ;; + + 10.6.*|\ + 10.6) sudo dscacheutil -flushcache + ;; + + *) sudo killall -HUP mDNSResponder + ;; esac ;;