How and why empty the DNS cache of our Mac in macOS Catalina and Big Sur

When we enter SamaGame.com in our browser, it takes care of converting the domain into the IP address of the machine that hosts the content. This conversion is made possible by DNS servers from which the Mac temporarily remembers its responses. In general, thanks to this memory, or cache, we can browse the web more quickly, but it can also give some errorsIn this case, the solution is easy: we empty the DNS cache of our Mac.

What is that DNS

When we browse the internet, each page we visit has an associated IP address. This address is the one we actually use to connect to the servers that host the page, but for convenience, We never enter it in the address bar, where we point domains, for example SamaGame.com.

The browser we use must convert the domain (SamaGame.com) to the IP address (something like 185.18.24.11, for example). And how does the browser know to which IP to translate each domain? Using a DNS resolution service. The Navigator ask the service what is the IP of this domain and the service, without going into more details, answers you.

DNS resolution service, the equivalent of the internet yellow pages.

For convenience, our Mac temporarily stores a list of the most recent responses it has received from the DNS service. In this way it should not be asking each time for the IP, which speeds up browsing by reducing response times, no matter how minimal. And it is precisely here where we find the subject of this article. What if our Mac has memorized information that has just changed?

The IPs of the pages and services may change without prior notice and although the cache is regenerated on a regular basis, this can cause some error in the navigation. It is an unusual situation but, as good advanced Mac users, we must bear in mind if we have verified, for example by visiting some other page, that our connection is good. If so, it is best that we empty the DNS cache of our computer.

How to flush the DNS cache

Emptying the DNS cache of our Mac is really simple and we will do it, in this case, from the Terminal. It is true that There are third-party apps, but if we do not want to install any of them The steps are the following:

  • We open the Terminal app, which we can look for in the LaunchPad or in Spotlight (Command (⌘) + Spacebar).
  • We copy and paste: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • We press Enter (↩︎).
  • We enter the password of our Mac, which we will not see on the screen.
  • We press Enter again.
  • That easy. Whether on our Mac running Catalina or Big Sur, all DNS resolution memory will be erased and the system will ask for them again. Thus, if there was any wrong information, it will be removed and replaced with the most current. Will we fix all navigation errors? Those related to DNS do, so if the error persists we know that we must investigate on other fronts.