How to Flush DNS Cache on a Mac

How to clear the DNS cache on your Mac

What to Know

  • Type Terminal into Spotlight, or navigate to Go > Utilities > Terminal
  • In the Terminal window, enter the command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

This article explains how to flush the DNS cache on a Mac.

How Do I Reset My DNS on a Mac?

If you’re experiencing connectivity issues, you may be able to fix them by resetting the local record of domain name server (DNS) information stored on your Mac. This information may be outdated or corrupt, which can prevent websites from loading and slow down your connection. To reset the DNS cache on a Mac, you need to enter a Terminal command on your Mac.

Here’s how to flush your DNS cache on a Mac:

  1. Type Command+Space to open Spotlight.

    Spotlight open and highlighted on a Mac.
  2. Type Terminal, and select Terminal from the search results.

    Terminal highlighted in Spotlight on a Mac.

    You can also access Terminal by navigating to Go > Utilities > Terminal.

  3. Enter this command into the Terminal window: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and then press Enter.

    Command highlighted in Terminal window

    This command only works in macOS El Capitan and newer. If you have an older version of macOS, check the next section for the correct command.

  4. Type your password, and press enter again.

    Entering a password in Terminal on a Mac.

    The password will not appear in Terminal as you type it. Just type the password and press enter.

  5. Your DNS cache will be reset, but there will be no message to that effect in the Terminal. When a new line appears, it indicates the command has been carried out.

    DNS flushed on a Mac.

How to Flush DNS in Older Versions of macOS

Older versions of macOS use different Terminal commands to flush the DNS. These commands are all entered in the same place, so you start by opening a Terminal window regardless of the version of macOS that you’re using.

Here are the commands to flush DNS in each version of macOS:

  • El Capitan and newer: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • Yosemite: sudo killall -HUP mDNSResponder
  • Lion, Mountain Lion, and Mavericks: sudo dscacheutil –flushcache
  • Snow Leopard: sudo lookupd –flushcache
  • Tiger: lookupd –flushcache

What Does Flushing a DNS Do?

Whenever you try to access a website over the internet, you connect to a DNS server which tells your web browser where to go. The DNS server maintains a directory of websites and IP addresses, which allows it to look at the website address, find the corresponding IP, and provide it to your web browser. That information is then stored on your Mac in a DNS cache.

When you try to access a website you’ve been to recently, your Mac uses its DNS cache instead of checking with an actual DNS server. That saves time, so the website loads faster. The web browser doesn’t have to go through the extra step of communicating with a remote DNS server, which results in less time between entering a website address and the website loading.

If the local DNS cache is corrupt or outdated, it’s kind of like trying to use an old phone book or an address book someone has vandalized. Your web browser checks the cache to find an IP address for the website you’re trying to visit, and it finds either the wrong address or an unusable address. That can slow the process down or even prevent websites or specific website elements, like videos, from loading.

When you flush your DNS cache, you instruct your Mac to delete its local DNS records. That forces your web browser to check with an actual DNS server the next time you try to access a website. You should always flush your DNS cache after you change the DNS servers on your Mac. It can also be useful if you’re having connectivity problems.

FAQ
  • How do I check the DNS cache on a Mac?

    Open the built-in Console log-viewer app on your Mac and type any:mdnsresponder into the search bar. Then, launch Terminal, type in sudo killall –INFO mDNSResponder, and press Enter or Return. Back in the Console app, you can view a list of cached DNS records.

  • How do I clear the DNS cache on Windows 10?

    To clear the DNS cache on Windows 10, open the Run dialog box, type in ipconfig /flushdns, and then click OK. You can also use the same command in the Windows command prompt if you want more information on the process.

  • What is DNS cache poisoning?

    DNS cache poisoning, also known as DNS spoofing, is when someone enters false or incorrect information deliberately into a DNS cache. After the false information is input, future DNS queries will return incorrect responses and direct users to the wrong websites.

Was this page helpful?