How to Flush DNS Cache on Your Mac Featured Image

How to Flush DNS Cache on Your Mac

Written by

Reviewed by

Last updated: September 11, 2023

Expert verified

SVG Image

Flushing the Domain Name System (DNS) cache on your Mac can be an essential troubleshooting step for a variety of connectivity issues. Whether you’re facing trouble accessing a website, encountering slow browsing speeds, or dealing with outdated web content, flushing the DNS cache can often be the quick fix you’re looking for.

In this guide, I’ll walk you through the simple steps to flush DNS cache on your Mac. I’ve shared the steps for different macOS versions to ensure your system accesses the most up-to-date information from the web.

Why You Should Flush DNS Cache on Mac

Flushing the DNS cache on your Mac can be a beneficial practice for several reasons, many of which revolve around improving network reliability and performance. Below are some compelling reasons why you might consider flushing your DNS cache on Mac:

  • 🔄 Refresh DNS Entries: The DNS cache stores IP addresses corresponding to website URLs for a period, which can lead to outdated or incorrect information. Flushing the cache can refresh these entries, ensuring your browser retrieves the most current DNS information.
  • 🛠️ Troubleshooting Connectivity Issues: If you’re experiencing difficulty accessing specific websites or services, clearing the DNS cache can sometimes resolve this issue. Flushing the cache will force your computer to look up new IP addresses, potentially bypassing any blocks or issues related to cached data.
  • 🚀 Improve Browsing Speed: In some cases, outdated DNS records can slow down your internet browsing speed. Flushing the DNS cache can improve performance by eliminating old data, and allowing your computer to fetch updated information.
  • ⏩ Implement DNS Changes Faster: If you’ve changed the DNS settings on your Mac or your network, flushing the cache can expedite the process of those changes taking effect. This is particularly helpful in corporate environments where DNS configurations may be updated frequently.
  • 🆙 Resolve Conflicts After Software Updates: Operating system or browser updates can sometimes lead to conflicts with existing DNS cache data. Flushing the cache can clear these conflicts, making for a smoother transition post-update.
  • 🛡️ Enhance Security: In rare cases, malware or compromised websites can manipulate DNS cache data for phishing or redirect attacks. Regularly flushing your DNS cache can provide an additional layer of security against such risks.
  • 🔍 Simplify Troubleshooting: When diagnosing network or website issues, having too many variables can complicate the process. Flushing the DNS cache eliminates one potential variable, making it easier to identify the root cause of a problem. But if it doesn’t help, you may have to contact Apple Support.

How to Check Your DNS Cache on a Mac

Checking the DNS cache on a Mac can be helpful for troubleshooting or simply to understand what DNS resolutions have been cached. However, macOS doesn’t offer a built-in, user-friendly graphical tool to view the DNS cache directly.

For those who are comfortable using the Terminal, it is possible to perform this task.

The following instructions are aimed at users familiar with the Terminal and should be executed with caution. Improper use of Terminal commands can result in various issues.

Viewing DNS Cache Using Terminal

  1. Navigate to Applications > Utilities > Terminal to open the Terminal application. Alternatively, you can use Spotlight (Command ⌘ + Space) and search for Terminal.
launch terminal from utilities
  1. To view the DNS cache, type the following command and press Enter:
sudo killall -INFO mDNSResponder
type sudo killall INFO mDNSResponder in terminal

This will dump the DNS cache into your system logs.

  1. To actually view the cache entries, open the Console app, which is also located in Applications > Utilities > Console.
launch console from utilities
  1. In the Console app, select your Mac and enter the following in the search bar:
any:mdnsresponder
type any mdnsresponder in console search bar

You can then look for entries related to mDNSResponder to view the DNS cache.

How to Flush DNS Cache on Your Mac

Manually flushing the DNS cache requires some effort. Since the steps vary for different macOS versions, you need to identify your macOS version first, and then input particular commands into the Terminal app.

To determine your macOS version, do the following:

  1. Click the Apple icon located at the top-left corner of your screen, in the menu bar.
  2. Choose About this Mac from the dropdown menu.
click apple icon and select about this mac
  1. A window will appear, displaying the specific version of macOS you are using.
macos version in about this mac info

After you’ve established your macOS version, you can proceed with manually clearing the DNS cache using the appropriate Terminal commands.

On macOS Ventura, Monterey, Big Sur, and Catalina

If you’re running macOS Ventura, Monterey, Big Sur, or Catalina and experiencing connectivity issues, sluggish browsing speeds, or accessing outdated web content, flushing your DNS cache might be the solution.

Follow the steps below to manually flush DNS cache on your Mac using macOS Ventura, Monterey, Big Sur, and Catalina:

  1. Open the Terminal application by navigating to Applications > Utilities > Terminal or by searching for it using Spotlight (Command ⌘ + Space).
type terminal in spotlight search
  1. In the Terminal window, input the following command and then press Enter:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
type sudo dscacheutil flushcache sudo killall HUP mDNSResponder in terminal
  1. You’ll be prompted to enter your Mac’s admin password to proceed. Do so and press Enter to execute the command.

After you enter the command and authenticate, your Mac’s DNS cache will be flushed. You’ll usually see no output if the operation was successful, which is standard for most Unix-based commands.

Always exercise caution when using the Terminal, especially when executing commands that require administrative privileges. Incorrect usage can lead to various system issues.

On macOS Mojave, High Sierra, Sierra, and El Capitan

Although the user interface has evolved in newer versions of macOS, the older versions still offer the robustness and reliability that Apple is known for. So, even if you’re using macOS Mojave, High Sierra, Sierra, or El Capitan, you can flush the DNS cache using Terminal.

Here’s how to flush your DNS cache on your Mac if you’re using macOS Mojave, High Sierra, Sierra, or El Capitan:

  1. Open the Terminal application by navigating to Applications > Utilities > Terminal or by searching for it using Spotlight (Command ⌘ + Space).
launch terminal from utilities
  1. Enter the following command and press Enter:
sudo killall -HUP mDNSResponder
type sudo killall HUP mDNSResponder in terminal
  1. After entering the command, you’ll be prompted for your admin password. Type it in and press Enter.

If performed correctly, this will flush the DNS cache. Typically, there’s no message to confirm the flush, but if you’ve entered the command correctly, it will have executed successfully.

Terminal commands require precise syntax, and misuse can result in system issues. Always be careful when using commands that require administrative or root permissions.

On macOS Yosemite

Although Yosemite is an older version of macOS, the steps to flush the DNS cache remain straightforward but are specific to this version. Follow the instructions below to flush DNS cache on your Mac running macOS Yosemite:

  1. Open Terminal by navigating to Applications > Utilities > Terminal.
launch terminal from utilities
  1. Enter the folloing command and press Enter:
sudo discoveryutil udnsflushcaches
type sudo discoveryutil udnsflushcaches in terminal
  1. Enter your Mac’s administrator password and press Enter.

Once you’ve done this, your DNS cache will be flushed. Typically, you won’t see any output to confirm that the command was executed successfully. However, if you’ve entered the command accurately, it should have performed the flush as intended.

Use caution when executing Terminal commands, especially those requiring admin or root permissions. Incorrect usage can result in unintended system behaviors.

On macOS Mavericks

For those using macOS Mavericks, here’s how to flush DNS cache on this macOS version:

  1. Open the Terminal application by navigating to Applications > Utilities > Terminal or by searching for it using Spotlight (Command ⌘ + Space).
type terminal in spotlight search
  1. Enter the following command and press Enter:
sudo killall -HUP mDNSResponder
type sudo killall hup mdnsresponder in terminal
  1. Enter your administrative password for the Mac and press Enter to flush the DNS cache.

Be cautious when using Terminal commands that require administrative rights. A slight error in command execution could lead to system issues.

Flush DNS Commands on All macOS and Mac OS X Versions

Below, I have shared the Terminal command for all macOS versions that you can use to flush DNS cache on your Mac, depending on the version you’re using.

Mac OS X or macOS VersionTerminal Command
macOS 13 (Ventura)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 12 (Monterey)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 11 (Big Sur)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.15 (Catalina)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.14 (Mojave)sudo killall -HUP mDNSResponder
macOS 10.13 (High Sierra)sudo killall -HUP mDNSResponder
macOS 10.12 (Sierra)sudo killall -HUP mDNSResponder
OS X 10.11 (El Capitán)sudo killall -HUP mDNSResponder
OS X 10.10 (Yosemite)sudo discoveryutil udnsflushcaches
OS X 10.9 (Mavericks)sudo killall -HUP mDNSResponder
OS X 10.8 (Mountain Lion)sudo killall -HUP mDNSResponder
OS X 10.7 (Lion)sudo killall -HUP mDNSResponder
OS X 10.6 (Snow Leopard)sudo dscacheutil -flushcache
OS X 10.5 (Leopard)sudo lookupd -flushcache
OS X 10.4 (Tiger)lookupd -flushcache

Please note that all these commands are version-specific and should be executed with caution. Always double-check your macOS version and ensure you’re using the correct command to avoid potential issues

What Does Flushing a DNS Do on Mac?

Flushing the Domain Name System (DNS) cache on a Mac essentially clears out the stored information that helps your computer translate website addresses (like www.example.com) into the numeric IP addresses that machines use to identify each other on the network.

This is often necessary for various troubleshooting procedures or after DNS changes to a domain have been made.

The DNS cache stores these domain name-to-IP address resolutions temporarily so each time you visit the same website, your computer doesn’t have to perform a DNS lookup. While this speeds up web browsing, it can sometimes lead to issues.

For example:

  • You may see an outdated version of a website if the IP address has changed since your computer last accessed it.
  • Sometimes, there could be an invalid entry that prevents you from reaching the correct site.
  • You might experience issues when a website has moved to a new server but your cache is still pointing to the old one.

Flushing the DNS cache can resolve these issues by forcing the computer to re-query the DNS information.

Flush DNS Cache on Your Mac

Now that you know how to flush DNS cache on your Mac, you may want to clean up your system further to get rid of junk files affecting its performance. Here are a few tips to get you started:

Frequently Asked Questions

  1. What is DNS cache?

    DNS cache is a temporary database maintained by a computer’s operating system. It stores records of all recent visits and attempted visits to websites and other internet domains. This helps speed up subsequent requests to the same domains, as the system can retrieve the IP address from the local cache rather than querying a remote DNS server each time.

  2. Can I check my DNS cache on a Mac?

    Yes, you can check your DNS cache on a Mac, although doing so requires using the Terminal application. By running specific commands, you can view the cached DNS entries your system is using. However, interpreting the data might be complex for users unfamiliar with DNS records and Terminal commands.

  3. When should I reset the DNS cache on Mac?

    You should reset the DNS cache on Mac when you’re experiencing network issues such as slow webpage loading, frequent “page not found” errors, or difficulty in accessing certain websites. Flushing the DNS cache can also be helpful after changing DNS server settings or updating domain configurations.

  4. Is it safe to flush DNS cache on Mac?

    Yes, it is safe to flush DNS cache on Mac and it is commonly done as a troubleshooting step for network-related issues. It clears the stored domain names and IP addresses, forcing your computer to fetch updated information. However, you should be cautious when using Terminal commands, as incorrect execution can lead to system issues.

  5. What is DNS cache poisoning?

    DNS cache poisoning, also known as DNS spoofing, is a malicious attack aimed at corrupting the DNS cache of a DNS resolver. In this attack, false DNS responses are introduced into the DNS cache, causing the name server to return an incorrect IP address. This can divert traffic to a fraudulent website, potentially leading to unauthorized data collection, malware installation, or other malicious activities.

Hashir Ibrahim

Author

I'm Hashir, a tech journalist with a decade of experience. My work has been featured in some of the top tech publications like MakeUseOf and MakeTechEasier. I have a bachelor's degree in IT, a master's in cybersecurity, and extensive knowledge of Apple hardware, specifically MacBooks. As the senior writer at MacBook Journal, I write in depth guides that help you solve any issues you have with your mac and unbiased reviews that help you make the right buying decisions.

Ojash

Reviewer

Hi there! I'm Ojash, a tech journalist with over a decade of experience in the industry. I've had the privilege of contributing to some of the world's largest tech publications, making my mark as a respected Mac expert. My passion lies in exploring, using, and writing about MacBooks, and I enjoy sharing my expertise to help others make informed decisions and get the most out of their MacBook experience. Join me as we delve into the fascinating world of MacBooks together!

Total
0
Shares
You May Also Like