How to clear the DNS cache on macOS

This article describes how to clear the DNS cache on a computer running Apple's macOS or Mac OS X.

Many computer operating systems use caching to store DNS lookup results. Normally, this is not a problem and accelerates network performance. However, when you are developing a web site or configuring domain settings, your computer's DNS cache can get in the way, preventing you from viewing the correct site.

To clear the DNS cache on Apple's macOS or Mac OS X, follow these steps:

  1. Open a terminal window. To do this, click Applications, click Utilities, and then click Terminal.
  2. At the command prompt, type the appropriate command for your macOS version to clear the cache:
    • For OS X Yosemite v10.10.4 or later, including macOS, type the following command:
      sudo killall -HUP mDNSResponder
      
    • For OS X Yosemite v10.10 through v10.10.3, type the following command:

      sudo discoveryutil mdnsflushcache
      
    • For OS X Mavericks, Mountain Lion, and Lion, type the following command:

      sudo killall -HUP mDNSResponder
      
    • For Mac OS X Snow Leopard, type the following command:

      sudo dscacheutil -flushcache
      
  3. The DNS cache is now clear.

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.