How to flush DNS cache locally in macOS Mojave, Sierra, OSX, Linux, and Windows

linux
osx
sierra
windows
macos
#1

Today, I am going to share with you a simple way to clear or flush DNS cache locally in macOS Mojave, Sierra, OSX, Linux and Windows. This just requires you to type the appropriate command in the Terminal/command line corresponding to your operating system.

How to flush the local DNS cache

macOS Mojave 10.14.0

sudo killall -HUP mDNSResponder;say DNS cache has been flushed

or

sudo killall -HUP mDNSResponder, sleep 2, echo macOS DNS Cache Reset | say

macOS High Sierra 10.13.0

sudo killall -HUP mDNSResponder;say DNS cache has been flushed

macOS Sierra 10.12.0

sudo killall -HUP mDNSResponder;say DNS cache has been flushed

OSX 10.11.0

sudo killall -HUP mDNSResponder

OSX 10.10.4

sudo killall -HUP mDNSResponder

OSX 10.10.0 – 10.10.3

sudo discoveryutil mdnsflushcache

OSX 10.9 – 10.8 – 10.7

sudo killall -HUP mDNSResponder

OSX 10.5 – 10.6

sudo dscacheutil -flushcache

Windows

ipconfig /flushdns

Linux (depending on what you’re running)

/etc/init.d/named restart

/etc/init.d/nscd restart

0 Likes