Technology

7 Easy Steps to Flush DNS Cache on a Mac: Quick Fix!

Flush DNS Cache on a Mac
Written by twitiq

There are a lot of reasons due to which you can find the DNS cache corrupted, for instance, because of viruses and network attacks. 7 Easy Steps to Flush DNS Cache on a Mac. As a result, you can see that the IP address mapping is corrupted for several websites. Suppose you search for www.facebook.com, but instead of going there, your browser can direct you to a malicious website’s IP address that is inserted by a cybercriminal into the Domain Name System records of your computer.

Otherwise, you can experience a lot of 404 errors. When you clear the Domain Name System cache, it will help you to delete all the saved Domain Name System lookup information. Therefore, whenever your computer sends a lookup request, it will receive updated data from Domain Name System servers.

What is DNS Cache?

A DNS cache refers to a record of all queries that a Domain Name System server makes from a browser. Once you input a link or URL into the browser, a request will be sent to the Domain Name System server, which wants you to give the URL’s IP address. As soon as the browser gets the address, it will load the proper website in your window.

What Does Flushing DNS Do?

Whenever you try to access a website in the web browser, the URL you enter will be sent to a Domain Name System server to get translated into an IP address. You can find the information in a cache so that you can retrieve it easily later on your Mac.

Suppose you want to open a website that you have recently opened. Rather than using an actual Domain Name System server, your Mac uses a Domain Name System cache to help to open that website. The web browser does not need to undergo additional steps of communication with the remote Domain Name System server. As a result, the website will load very quickly as soon as you enter the website address.

Is your local Domain Name System cache outdated or corrupted? It is like attempting to use an old mobile which has been vandalized. With the purpose of finding an IP address for the website you want to visit, the web browser checks the cache. But the browser finds an address that is either wrong or unusable. As a result, the process gets slowed down or it can stop websites from loading.

Flushing the Domain Name System cache indicates that you are giving instructions to your Mac to delete local Domain Name System records. Therefore, your browser uses a Domain Name System server to check and get fresh information. Once you change the servers on your Mac, you need to flush the Domain Name System cache. Whether you are facing any connectivity issues, you can use this trick.

Why Would You Flush Domain Name System Cache?

Reasons why you might have to flush the Domain Name System cache on a Mac can be related to security, technical problems, or data privacy.

  • Prevent Domain Name System Spoofing:

People call DNS spoofing DNS cache poisoning. In this attack, cybercriminals can access your DNS cache. Then, they can change the information to redirect you to the wrong sites. Sometimes, they ask you to go to a fraudulent website that looks like the targeted destination, tricking you to enter sensitive information such as online banking login information.

  • Seeing A 404 Error:

Suppose you have cached a website’s Domain Name System information. But now it has moved to another new domain name or host. If it happens, you may find that Domain Name System information is not getting updated quickly. As a result, you can experience a 404 error. Otherwise, when you visit any website, you will see its outdated version. It is possible to clear this cache at any time.

  • Trouble In Accessing A Website:

Are you unable to load a website easily? If this is the case, you should try to clear cookies and temporary files of your browser. Besides, you can try to adjust your browser settings to make pop-up blockers disabled. It enables sites to save cookies and read them. Have you exhausted your options? If so, you have to flush the Domain Name System records. Then, you need to request the server again.

  • Keep Your Search Behavior Private:

Are you thinking about tracking the behavior of any user on the web? Then, probably that you are thinking of cookies. However, the Domain Name System cache may be the reason behind revealing your search history. It is because this one works as a virtual address book that helps to store website (visited regularly) information. Flushing this cache regularly is a good way to keep your information private and away from hackers.

  • Domain Name System Propagation:

This procedure can take between 24-72 hours. That’s why cached data can be outdated sometimes. As a result, you can face troubles while accessing websites. Or you can see that sites are displaying old content. In this case, you should try to clear your browser cache. But sometimes, it might not be enough. Suppose you have recently changed your Domain Name System records for your domain name. However, the changes might not have propagated globally yet.

In this case, it is important to flush the Domain Name System cache. Once you do this, it will be possible to prompt your computer to update Domain Name System records in the cache. Hence, when you visit your site, your browser will ask your Domain Name System server to provide the most recent Domain Name System records information.

So, now you definitely understand what is flushing Domain Name System Cache and why you need to do it. Now, let’s learn how to do it.

How To Check Domain Name System Cache On Mac:

Before you free up space, you have to check the Domain Name System cache on your Mac. It enables you to determine if you have to take any action or not. These are the steps you need to follow before deleting anything to check the Domain Name System cache on Mac:

  • Your first task is to open the Console app. Then, you need to select the Mac you use. In the search bar, you have to enter any:mdnsresponder.
  • After opening a Terminal window, your task is to enter sudo killall –INFO mDNSResponder.
  • Once prompted, your job is to enter the password. You need to keep in mind that you are not going to see the password on the screen. So, it is important to type the password properly and thereafter you need to hit the Enter key.
  • Your task now is to return to the Console app. Then, you have to see the cached DNS records list.
  • Also, it is possible to view the DNS cache via your internet browser on your Mac. If you use Chrome, you need to enter chrome://net-internals/#dns in the address bar. Thus, you can see the cached Domain Name System record list.

How To Use The macOS Flush DNS Command:

Are you facing internet connectivity problems? Then, you need to try to reset this cache with a Terminal command to get rid of the problem. The process will take a few moments only.

  • You first need to open Terminal by hitting Command+Space at a time so that you can launch Spotlight. Next, your task is to type Terminal. After typing it, you need to select this from the results available to you.
  • Then, you need to head toward Go and then Utilities. Next, you should move to the Terminal to access it.
  • Your task now is to type the following command into Terminal. Or you can copy and paste this. After doing this, your job is to hit Enter:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

  • You should apply the command only in macOS 10.12 Sierra and newer.
  • After typing the password, your job is to hit return. Then, you will be able to reset the cache instantly. But you won’t see any message to that effect. If you view a new line, it means that the command is carried out.

How To Flush DNS Cache on a MacOS Version By Accessing The Terminal Application On MacOS:

MacOS features an in-built command line interface (CLI), which is known as the Terminal app. It lets you enter text-based commands, which your OS will carry out. You can open the terminal in different ways. However, the simplest way you should follow is through Spotlight search.

  • In this case, you need to head toward the screen’s top right corner. Then, you need to tap on the icon which will look like a magnifying glass. Otherwise, you are able to use the Command Space shortcut.
  • In both cases, you can see a window opening up.
  • Then, your job is to type Terminal. Once you see the Terminal.app option, you need to tap on it.
  • A window will appear thereafter.
  • Your job now is to enter a command in the terminal window.
  • Different commands are used for different versions of macOS. So, you need to follow a specific command based on your version. Remember that every macOS version comes with a version name and number.
  • You need to tap on the Apple icon located at the screen’s top left corner to find out the macOS version. Once you see the dropdown menu appearing, your task is to select About This Mac.
  • When you are in the Overview tab, you will see the version name. After that, the version number will appear.
  • Now, you can see the macOS versions in reverse chronological order — that starts with the latest ones and ends with the oldest ones.
  • Your job now is to move to your Mac version. Next, you need to copy the respective command.
  • As soon as you type the command and press enter, you will be asked to enter the password of your computer.
  • While typing passwords, you will not see anything, not even any asterisks.
  • As soon as you enter the password and press enter, you are not going to view a message which can inform you that the process is completed. Rather than that, you get to see a new terminal prompt.

How To Flush DNS Cache on a Mac OS X:

The Mac OS X flush DNS command is not like those which are used in the modern OS versions. You first need to open the Terminal. After opening this, your task is to enter the necessary command corresponding with your version.

  • You need to enter sudo killall -HUP mDNSResponder to flush the cache on macOS Catalina, Sierra, High Sierra, Mojave, and macOS El Capitan.
  • You have to enter sudo discoveryutil udnsflushcaches to clear the cache on macOS Yosemite.
  • In order to flush this on macOS Lion, Mountain Lion, and Mavericks, you have to enter: sudo killall -HUP mDNSResponder.
  • If you want to clear the Domain Name System cache on macOS Snow Leopard, you have to enter this command: sudo dscacheutil -flushcache.
  • In order to flush the DNS cache on macOS Leopard, you need to enter this command: sudo lookupd -flushcache
  • You have to enter lookupd -flushcache command to clear the cache on macOS Tiger.

Is It Safe To Flush DNS Cache on a Mac?

Yes, it is safe and easy to clear the Domain Name System cache. However, if you want, you are able to choose clearing it only for the Chrome browser. In order to do so, your job is to enter chrome://net-internals/#dns in the Chrome address bar. Then, you have to tap on the Clear host cache. Now, let’s learn how often you should flush DNS cache on a Mac.

How Often Should You Flush DNS Cache On A Mac?

You can clear the local DNS cache daily, which ensures that you will have consistent access to the internet and keeps the network secure. It is true that you can reset the Domain Name System cache at any time. However, it is recommended to flush the Domain Name System cache systematically. To get rid of DNS errors, and connectivity issues you should reset the cache on your macOS on a regular basis.

The Bottom Line:

Now you know how to flush DNS Cache on a Mac. Performing the methods, which are mentioned in this article can help you get rid of the connectivity problems you may experience. It is a good idea to clear the Domain Name System cache frequently so that you can fix troublesome internet connections. Thus, you can make sure that your system remains protected from potential threats.

 

About the author

twitiq