How to Clear DNS Cache in macOS High Sierra or Older Versions

Clearing or resetting DNS caches in your Mac operating system is a good idea as it speeds up the lookups within the same host. But sometimes we just want to clear the cache so it doesn’t hold the values that are no longer valid.

And it is pretty simple too. All you need to do is execute one or a couple of commands in Terminal and you are all set.

If you are using the latest macOS Mojave, click here to get the command on how to reset DNS cache in macOS Mojave; for the rest of the macOS versions, you can get the commands below.

Step 1

Launch the Terminal app, either by going into Applications > Utilities >, or by typing Terminal in the Sportlight.

Note: Keyboard shortcut for Spotlight: Command + Space.

launch terminal

Step 2

Refer to the list below to find the command for your macOS version. Copy its respective command, paste it in Terminal and hit Enter. Should Terminal prompt asks for the password, enter your Mac’s password and hit Enter again.

Note: To find out which version of macOS you are using, simply click the Apple logo on the top left corner, select About This Mac, and click on the Overview tab.

insert command and hit enter
"High Sierra" (Version 10.13)
sudo killall -HUP mDNSResponder; sleep 2
"Sierra" (Version 10.12)
sudo killall -HUP mDNSResponder
"El Capitan" (Version 10.11)
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
"Yosemite" (Version 10.10)
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches
"Mavericks" (Version 10.9)
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
"Mountain Lion" (Version 10.8)
sudo killall -HUP mDNSResponder
"Lion" (Version 10.7)
sudo killall -HUP mDNSResponder
"Snow Leopard" (Version 10.6)
sudo dscacheutil -flushcache
"Leopard" (Version 10.5)
sudo dscacheutil -flushcache
"Tiger" (Version 10.4)
lookupd -flushcache

That’s it! Your Mac’s DNS should now be resetted.

Show Comments