The Apple macOS Blog

How to clear the DNS cache on your Mac

Published: 12th of September, 2024

Authored by Simeon
Charlie Simeon
Your friendly Mac guide & technician

Hey everyone! Are you having trouble with websites loading slowly or not at all? To solve this problem you might just need to clear your Mac's DNS cache. Clearing this cache is pretty easy so today I'll show you how in just a couple of easy steps.

 

So what is the DNS Cache anyway?

The Domain Name System, or just "DNS", translates domain names to the numerical IP addresses needed for locating computer services. This let's you type in things like google.com to your browser instead of remembering IP addresses and having to enter those numbers. Think of it as the phonebook of the Internet. Whenever you browse the web your browser will perform many lookups to your DNS server. Your Mac saves this DNS info in a cache (temporary storage) to reduce the number of requests thus loading subsequent pages faster. For example if you visit google.com in Safari, macOS will do a DNS lookup and store it in the DNS cache. If you then visit google.com again a few minutes later it will just use the cached result from the lookup a few minutes ago. If the cached DNS info gets old (us techies call it stale data) or otherwise messed up, it can cause issues. Clearing your DNS cache can force new correct data to be added thus fixing the problem.

 

Steps to Clear DNS Cache

Clearing the DNS cache on macOS is easy, but will require opening the Terminal. Many Mac users might be more used to doing things in a point-and-click fashion, but there's really no need to be intimidated by entering commands because it's all pretty easy once you know how!

First, we open the Terminal

Press Command + Space, type Terminal then press Enter.Another way to open the Terminal is by using Finder to navigate to ApplicationsUtilities, then just double-click on Terminal.app

Next, we execute the command!

In the Terminal window, type the right command for your macOS version:

  • On macOS Monterey or newer (unless your Mac is ancient do this):
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • On older macOS versions:
    sudo killall -HUP mDNSResponder

Now press the enter key on your keyboard. 

Mac will now ask for your password. This is the password you use when turning on your Mac, not your iCloud or any other online password. Type it into the Terminal window (you won't see it) then just hit the enter key again.  

 

That was easy, wasn't it?!

No need to wait for a message or anything — once the command runs, you're all done! Just close Terminal, you can do this by hitting CMD + Q or just typing exit then hitting enter.In the unlikely event that you're still having trouble, try restarting your Mac.

 

Bonus Tip
To further speed up your browsing, block ads and protect your Mac against all sorts of internet nasties you should use iAntiSpy.
Visit it's homepage or the Mac App Store to learn more or download it free.

 

That's really all it took! Clearing your Mac's DNS cache can and does fix a lot of niggling little internet issues.

Till next time,
 ✌ Charlie

 

Share this article:

Facebook share button Twitter/X share button

Comments

No comments yet, be the first!


Leave a comment

Please enter your name.
Please enter a valid email address.
Please enter your comment.

Your email is for verification only and will not be published. Comments are your own responsibility.




Recent articles:
Understanding Relocated Items on a Mac: What They Are and How to Handle ThemHow to Save Battery on Your Mac: 7 Simple TipsHow to Fix Common Mac Startup ProblemsMacBook Wi-Fi Connection TroubleshootingSpeeding Up Your Mac: Chrome and BeyondApple Silicon Performance GuidemacOS Malware Trends in 2024: comprehensive analysisHow to Fix MacBook USB Accessories Disabled ErrorsHow to Clean Your Mac Keyboard Like a ProHow to Manage System Data on Your iPhone: A Friendly GuideHow to Run .exe Files on your MacTop 40 Most Uninstalled Mac Apps of 2024How to Securely Erase Your Mac's Hard Drive: A Friendly GuideMac running slow? How to speed up a slow MacAll blog articles

iBoostUp icon

iBoostUp

Reclaim gigabytes of space and protect your Mac against malware.
iBoostUp is the #1 utility to keep your Mac happy and good as new.
Created by security experts. Made in Australia. Established 2009.

Download FREE!
macOS 10.11+, Sequoia supported.