Clearing DNS Cache on macOS


Have you ever heard of DNS? DNS stands for Domain Name System, and it's something like the phone book of the Internet. It translates the human-readable web addresses that we enter into our browser into the numeric IP addresses that computers use to communicate with each other.

In most cases, we don't even notice that our computer is performing this process in the background. But sometimes, problems with the DNS cache, such as outdated or faulty data, can lead to connection problems. In such cases, it can be helpful to clear the DNS cache. In this blog post, I'm going to show you how to do this on macOS.

Step 1: Open Terminal

The first step is to open the Terminal on your Mac. You can find it in the "Utilities" folder, which is in the Applications directory. You can also find it very easily by typing "Terminal" into the Spotlight search.

Step 2: Enter Command

Next, you need to enter the following command into the Terminal:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

This command actually consists of two parts:

  • sudo dscacheutil -flushcache: This command clears the DNS cache.
  • sudo killall -HUP mDNSResponder: This command sends a "Hang Up" signal to the mDNSResponder process, which is responsible for managing the DNS cache. This causes the process to restart and begin with an empty cache.

Prepending sudo to both commands means that they are executed with administrator rights. Therefore, you will be asked to enter your password.

Step 3: Done!

That's it. Your DNS cache is now cleared and should no longer contain any outdated or faulty data. This should help you solve any potential connection problems.

Please note that clearing the DNS cache is only one of many possible solutions to internet problems. If you are still having problems, it may be useful to also check other aspects of your network or your computer.