How to Flush DNS Cache on Your Mac Featured Image

How to Flush DNS Cache on Your Mac

Resolve website issues with DNS flush.

Written by

Reviewed by

Last updated: September 25, 2024

Expert verified

SVG Image

TL;DR

To flush DNS cache on your macOS Sequoia:

  1. Open Terminal.
  2. Type: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. Enter your password if asked.

Tried and Tested ✅: The methods and steps mentioned in this article have been tried and tested firsthand by Ojash Yadav on his MacBook Pro M3 and rechecked for errors on Hashir’s MacBook Air M2.

If you’ve ever had issues with websites loading slowly or not at all, DNS cache could be the reason. Flushing it is a quick fix that often gets things back to normal. Here is how you can do it.

What is DNS Cache, Why Flush It, and When?

DNS cache temporarily stores the IP addresses of websites you visit, making them load faster by skipping the DNS lookup process.

Why Should You Flush It?

Flushing DNS cache removes outdated or incorrect entries, which can solve issues like slow page loading, website errors, or connectivity problems.

When Should You Flush It?

  1. If you’ve recently dealt with malware or network security issues.
  2. When websites are not loading or displaying correctly.
  3. After changing your DNS settings (e.g., switching to Google DNS or Cloudflare).

How to Flush DNS Cache on Your Mac

Why You Can Trust MacBook Journal verify badge We always conduct first-hand research and verify every method or solution we present, ensuring you receive reliable and effective advice. Learn more about our process.

Flushing DNS cache on a Mac is a quick process that can help resolve network issues. Follow the steps below based on your macOS version, starting from the latest to the older versions.

Note: The process for flushing DNS cache can vary slightly depending on the macOS version you’re using. Make sure to follow the right steps for your specific version.

For macOS Sequoia, Sonoma, and Ventura

  1. Open Terminal (you can find it using Spotlight Search or in Applications > Utilities).
  2. Type the following command and press Enter:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
clearing cache on macos sequoia sonoma and ventura
  1. Enter your administrator password if prompted, and press Enter again.
  2. You won’t see any output, but the cache has been flushed. Close Terminal.

For macOS Monterey, Big Sur, and Catalina

  1. Type this command and hit Enter:
sudo killall -HUP mDNSResponder
clearing cache on macos monterey big sur and catalina
  1. Provide your administrator password if required.
  2. Once the command runs, the DNS cache is cleared.

For macOS Mojave and High Sierra

  1. Use the following command to flush the DNS cache:
sudo killall -HUP mDNSResponder
clearing cache on macos mojave and high Sierra
  1. Input your password, press Enter, and the cache is flushed.

For macOS Sierra and Earlier Versions

  1. Enter this command:
sudo discoveryutil mdnsflushcache
clearing cache on macos sierra and earlier versions
  1. Press Enter, provide your password, and the DNS cache will be cleared.

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

macOS Version DNS Flush Command
Sequoiasudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Sonomasudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Venturasudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Montereysudo killall -HUP mDNSResponder
Big Sursudo killall -HUP mDNSResponder
Catalinasudo killall -HUP mDNSResponder
Mojavesudo killall -HUP mDNSResponder
High Sierrasudo killall -HUP mDNSResponder
Sierrasudo discoveryutil mdnsflushcache
El Capitan and Earliersudo discoveryutil mdnsflushcache

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

How to Check Your DNS Cache on a Mac

To view the DNS cache on a Mac, you can use the following steps. This will show you the cached DNS entries currently stored by your system:

  1. Use Spotlight Search (Cmd + Space) and type Terminal.
  2. To check the DNS cache contents, use this command:
sudo dscacheutil -cachedump -entries 
checking dns cache on mac

This will show you a detailed list of cached DNS entries

  1. If you’re using macOS versions like Sierra or earlier, use the following command instead:
sudo discoveryutil udnsflushcaches

You will see a list of domain names that your system has cached. This information can be useful for troubleshooting DNS-related issues.

Flush DNS Cache on Your Mac

Now that you know how to flush DNS cache on your Mac, you may want to improve your browser experience further. Here are a few tips to get you started:

Frequently Asked Questions

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.

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.

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.

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.

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.

Ojash

Author

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!

Hashir Ibrahim

Reviewer

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.

Total
0
Shares
You May Also Like