Flushing your DNS cache in Mac OS X and Linux

OS X 10.4 (Tiger)

  1. Open up a terminal window (Located in /Applications/Utilities).
  2. To flush your DNS cache, enter the following command:
    macbook$ lookupd -flushcache
  3. Type logout, and then press the 'Enter' key to close the window.

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

  1. Open up a terminal window (Located in /Applications/Utilities).
  2. To flush your DNS cache, enter the following command:
    macbook$ dscacheutil -flushcache
  3. Type logout, and then press the 'Enter' key to close the window.

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

  1. Open up a terminal window (Located in /Applications/Utilities).
  2. To flush your DNS cache, enter the following command:
    macbook$ sudo killall -HUP mDNSResponder
  3. Type logout, and then press the 'Enter' key to close the window.

OS X 10.9 (Mavericks)

  1. Open up a terminal window (Located in /Applications/Utilities).
  2. To flush your DNS cache, enter the following command:
    macbook$ dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. Type logout, and then press the 'Enter' key to close the window.

OS X 10.10 (Yosemite)

Versions 10.10.1, 10.10.2, 10.10.3

  1. Open up a terminal window (Located in /Applications/Utilities).
  2. To flush your DNS cache, enter the following command:
    macbook$ sudo discoveryutil udnsflushcaches
  3. Type logout, and then press the 'Enter' key to close the window.

Versions 10.10.4+

macbook$ sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed

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 .