Flushing your DNS cache in Mac OS X and Linux

Flushing your cache on Mac OS X

Before you begin

The following section is also available as an instructional video:

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 10.12 (Sierra) and later

macbook$ sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache

OS X 10.11 (El Capitan) and OS X 10.12 (Sierra)

macbook$ sudo killall -HUP mDNSResponder

Older versions

OS X 10.10 (Yosemite)

Versions 10.10.4+

macbook$ sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

Versions 10.10.1, 10.10.2, 10.10.3

macbook$ sudo discoveryutil udnsflushcaches

OS X 10.9 (Mavericks)

macbook$ dscacheutil -flushcache; sudo killall -HUP mDNSResponder

OS X 10.7 (Lion) and 10.8 (Mountain Lion)

macbook$ sudo killall -HUP mDNSResponder

OS X 10.5 (Leopard) and 10.6 (Snow Leopard)

macbook$ dscacheutil -flushcache

OS X 10.4 (Tiger)

macbook$ lookupd -flushcache

Flushing your DNS cache in 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:

[local]$ sudo service nscd restart 

Alternatively, you can try these commands:

[local]$ /etc/rc.d/init.d/nscd stop
[local]$ /etc/rc.d/init.d/nscd start

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?