How To Refresh Your DNS Cache in OS X

The Domain Name System (DNS) is a hierarchical network that resolves text-based URLs such as “” to the servers IP addresses that your computer uses for communication.

A fast DNS service will optimize a connection, but redundant queries to it will take time to complete. Therefore, based on your DNS server’s configuration OS X will cache its DNS query results for a predetermined amount of time to allow quicker access to the results of recent DNS lookups. This time is usually relatively short (between a few minutes to a few hours), but this time depends on the DNS server being used; some may be configured to update the cache at far greater intervals such as a day or longer.

While for the most part the cache should optimize connections and keep your Internet connections running smoothly, there are times when it becomes corrupted or contains out-of-date information and doesn’t properly resolve a needed Web resource. Problems with the cache can also lead to a slower browsing experience.

If you are experiencing browsing problems, then along with other routines like clearing your browser’s cache and troubleshooting network connections, your router settings, and browser plug-ins, you might also consider clearing the cache.

Apple has recently outlined how to clear the cache, since the methods for doing this have changed in recent releases of OS X.

The classic method of clearing the DNS cache is to run the following command in the Terminal:

sudo dscacheutil -flushcache

 However, in OS X Lion and Mountain Lion, Apple has changed the method for caching DNS queries, which un-links it from the “dscacheutil” command, so if you run this in newer versions of OS X, you may get an error that states, “Unable to get details from the cache node.”

In these versions of OS X, Apple has changed the caching routines done by the mDNSResponder process (the core process responsible for DNS resolution) so they are kept in memory by the process as long as it maintains a connection to the DNS network.

Therefore, to clear the cache, you just need to send the mDNSResponder process a hang-up command to have it reinitialize its configuration without being fully shut down and restarted. To do this, you can run the following command in the Terminal:

sudo killall -HUP mDNSResponder

In addition to the killall command in the Terminal, you can also clear the cache in Activity Monitor by the following process:

  • Open Activity Monitor (in the /Applications/Utilities/ folder).
  • In the main Activity Monitor window is not present, press Command-1 to show it.
  • Locate and select the mDNSResponder process (you can search for it to make this easier).
  • Choose Send Signal To Process from the View menu.
  • Select Hangup from the menu that appears (it should be the first option that is already selected).
  • Click the Send button.

When you do this, you may see another mDNSResponder process appear for a few seconds in Activity Monitor as the system reinitializes the process, and once this disappears, the DNS cache should be cleared.

You may also Read: