Mac Performance

How to Flush your DNS Cache on Mac

Most of the time, your Mac’s DNS cache isn’t something you need to worry about. It works quietly in the background, sending you to the right websites when you ask for them. But if it gets corrupted, then you can run into problems loading sites, with 404 errors being common. One solution is to clear your Mac’s DNS cache.

 

Thankfully, you can flush DNS cache on Macs in just a few short steps. 

 

Before we start

 

If you’re flashing your DNS cache because you’re experiencing problems, you might have malware on your Mac. It’s worth running a scan with MacKeeper just to be sure.

  1. Open MacKeeper, and select Antivirus from the menu
  2. Click Start scan
  3. Wait for the scan to finish
  4. If MacKeeper finds any suspicious files, take the recommended actions.

Hopefully, your Mac is free of malware, but you should always make sure it’s protected. You can try out MacKeeper for free, and you get one free fix to see what it can do.

How to flush DNS cache on Mac

Flushing your Mac’s DNS cache can take the different road, depending on your macOS version. For your convenience, our experts divided the instructions on how to flush DNS cache for two most popular macOS versions.

To flush your DNS cache on macOS Monterey and Big Sur

For the newer macOS versions, try out the instructions explained below.

  1. Click the Spotlight search button or use Command+Space to do a search
  2. Type in Terminal, and double-click the Terminal application under Top Hit to open it
  3. Once Terminal is open, enter this command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  4. Enter your Mac’s password and then press Enter to clear the DNS cache.
The typical Mac’s desktop view showing the Spotlight search as a primary step to flush the DNS cache
Step 1. Open the Spotlight
To proceed with the task of flushing the DNS cache on your Apple computer, type Terminal on the Spotlight search and open it
Step 2. Search for Terminal in Spotlight
As an alternative way to find and open Terminal on your Mac, click Applications, open the Utilities folder, and double-click on Terminal.
Step 3. Or open Terminal via Utilities
Whatever the option you choosed to open Terminal, now it’s time to type the command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Step 4. Enter the Terminal command
When all is set, you might need to enter your ID password and choose Enter to confirm your action
Step 5. Enter the password to confirm the action

How to сlear the DNS in older macOS versions

Older macOS versions use different commands. To flush the DNS cache in these older versions, enter these in Terminal:

  • In macOS El Capitan or newer, run sudo killall -HUP mDNSResponder
  • For macOS Yosemite, enter sudo discoveryutil udnsflushcaches
  • In Mac OS Lion, Mountain Lion and Mavericks, the command is sudo killall -HUP mDNSResponder
  • In Mac OS Snow Leopard, enter sudo dscacheutil –flushcache
  • For MacOS Leopard, run sudo lookupd –flushcache
  • And in Mac OS Tiger, use lookupd –flushcache.

Once you’ve flushed the DNS cache on your Mac, check the problematic website to see if the problem is fixed and you’re able to visit the site normally again.

Clearing browser caches with MacKeeper

Clearing browser caches regularly for all your browsers can be time consuming. With a cache clearing tool like MacKeeper, you can clean all caches automatically and get the job done in a snap.

MacKeeper can analyze any files that hog space on your Mac, while protecting you from accidentally deleting important system files.

 

To get clear your browser caches with MacKeeper:

  1. Download and install MacKeeper on your Mac
  2. Launch the tool and then go to the Cleaning section in the right pane
  3. Click Safe Cleanup
  4. Click the blue Start Scan button
  5. Next, check the Caches box, and click to select all the caches you want to clear. These include user caches, system caches, mail caches and browser caches
  6. Click the blue Clean Junk Files button to confirm your action. MacKeeper will clear all the browser caches and clean any junk files that prevent your Mac from working properly.
The Safe Cleanup tool opened in the MacKeeper’s app as the efficient method to clear your brower caches on a Mac
Step 1. Go to Safe Cleanup in MacKeeper
In the MacKeeper’s Safe Cleanup tool, the Start Scan button selected, highlighted with the red box, shows the next step to proceed
Step 2. Start scan in Safe Cleanup
The Safe Cleanup screen lists the found caches and the volume they contain on your computer. Open the Caches folder to see its contents
Step 3. Click on the Caches folder
The new Safe Cleanup screen showing the contents of the Caches folder. Now you can pick the items you want to delete and click on Clean Junk Files
Step 4. Select the items and click on the Click Junk Files

What is DNS cache?

To understand what a DNS cache is, you first need to know what DNS is. When you load a website, you connect to a DNS (Domain Name System) server online. This looks at the web address in your browser, and it then checks that against a database of IP addresses. These IP addresses tell your web browser where to find the server that contains that website. This process is called a DNS lookup.

 

The DNS cache is a temporary database on your computer of all the recent DNS lookups it’s carried out. This enables your browser to resolve these lookups faster, thereby cutting down web page loading times.

Why you should clear DNS cache

Over time, the DNS cache can become outdated or corrupted, leading to connectivity problems. It can also be affected by malware, causing your browser to take you to malicious sites or phishing schemes.

 

Flushing your Mac’s DNS cache can eliminate these problems. However, if you do find your browser redirecting to malicious sites, our team also suggests you run a malware scan on your Mac with the help of MacKeeper’s Antivirus.

The bottom line

Clearing your Mac’s DNS cache can help when you’re unable to access a website and you’re not sure what’s causing the problem. With the detailed steps in this guide and cleaning/maintenance tools like MacKeeper, you can resolve the problem, get back to browsing the web and help your Mac run more smoothly.

FAQs

1. How often should I flush the DNS cache on Mac?

There’s no recommended time span, but you can do it as often as needed without causing any harm to your Mac.

2. How do I check my DNS cache on a Mac?

To check DNS cache on your Mac:

  1. Open the Console app, select your Mac and then enter any:mdnsresponder in the search bar
  2. Open a Terminal window, and enter sudo killall –INFO mDNSResponder
  3. Go back to the Console app and view the list of cached DNS records
  4. You can also check DNS cache entries in your web browser. For example, if you’re using Chrome, enter chrome://net-internals/#dns in the address bar to view the current list of cached DNS records.

3. Is it safe to flush DNS cache?

Yes, it’s safe to flush DNS cache on your Mac. Cached data is simply temporary storage, but flushing DNS cache too often prevents it doing its job of speeding up page loading.

 

Clearing your Mac’s DNS cache can help you hide your search behavior, protect against manipulation by cybercriminals and solve technical problems when accessing web apps. But there’s no point in doing it if you don’t need to.

4. How do I clear DNS cache in Safari?

Safari browser also keeps a DNS cache. When you restart the browser, it clears the cache automatically, but you can do the same manually without relaunching the app.

  1. In Safari, go to Safari > Preferences in the menu bar
  2. Click Advanced and then tick the Show Develop menu in menu bar box to enable the Develop menu
  3. From the menu bar, select Develop > Empty Caches. Once your browser cache is cleared, quit and relaunch the browser.
As Safari is number-one used browser worldwide, it’s good to know how to remove DNS cache here. For a start, click Safari > Preferences
Step 1. Open the Safari Preferences
As a final step to clear DNS cache in Safari on Mac, go to the menu bar and click on the Develop tab. In the list shown, select Emphy Caches
Step 2. Tick the Show Develop menu in menu bar
safari empty caches
Step 3. Confirm the caches removal

Read more guides:

Use your Mac to the fullest! Sign up and get:
Effective tips on how to fix Mac issues
Reliable advice on how to stay safe online
Mac-world news and updates

Thank you!

You’ll love exploring your Mac with us.

Oops, something went wrong.

Try again or reload a page.

Here’s another sign you need to upgrade your macOS ASAP:

30% off your MacKeeper subscription

Сopy the code now and use it in the MacKeeper checkout after the upgrade.

Copy Code

Please be aware that this code cannot be combined with any other discounts, offers, or promotions.

PC

MacKeeper - your all-in-one solution for more space and maximum security.

Try Now

Contents

bg
Don’t go! Enjoy our Black Friday deal

Add MacKeeper to your shopping list to live the event to the fullest.

Try 1 Week for $1
arrow

Run Application

step_1

Click Continue

step_2

Click Install

step_1

Your macOS version is lower than OS 10.11. We’d like to offer you MacKeeper 4 to solve the cleaning, privacy, and security issues of your macOS.