How to flush DNS on Mac and Linux

Mac:

The commands to flush cache in OS X are slightly different depending on the version you're running. First, make sure you've opened up your terminal on your computer. Once opened, run the command below that corresponds to your version of OS X.

OS X 12 (Sierra) and later
sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache
OS X 11 (El Capitan) and OS X 12 (Sierra)
sudo killall -HUP mDNSResponder
Older versions
OS X 10.10 (Yosemite)
Versions 10.10.4+
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
Versions 10.10.1, 10.10.2, 10.10.3
sudo discoveryutil udnsflushcaches
OS X 10.9 (Mavericks)
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
OS X 10.7 (Lion) and 10.8 (Mountain Lion)
sudo killall -HUP mDNSResponder
OS X 10.5 (Leopard) and 10.6 (Snow Leopard)
dscacheutil -flushcache
OS X 10.4 (Tiger)
lookupd -flushcache

Linux:

Most current Linux distributions do not use a DNS resolver cache in the same way that Windows and Mac OS X use. To confirm which particular daemon is installed for your Linux distribution, check the website or its forum pages.

However, a common DNS caching application sometimes used is the Name Service Caching Daemon (nscd). It’s most likely not installed by default so there is no need to flush the cache. But, if you’ve already installed it you can flush the cache by running the following command in a terminal:

sudo service nscd restart 

Alternatively, you can try these commands:

/etc/rc.d/init.d/nscd stop
/etc/rc.d/init.d/nscd start


Was this article helpful?

mood_bad Dislike 1
mood Like 0
visibility Views: 1561