The Doman Nane Servive, better known as DNS, is in charge of switching between the name of the web pages and their IP addresses, which is actually the physical address where it is located. Sometimes the DNS that our provider offers us, a process that is carried out automatically, does not usually work as it should and the conversion process takes longer than normal, affecting the connection speed when we want to access a web page. If you have had a problem with DNS and you intend to change it to Google's, the most recommended in all cases, you must clear the DNS cache for them to work properly.
First of all, it must be taken into account that this process is carried out through Terminal with a command line, so is aimed at advanced usersThose who know what the problem of their connection may be and have grown tired of seeing how their speed is increasingly slow without their access provider offering any solution. To clear the DNS cache of our Mac so that the new DNS come into operation, we must proceed as follows.
Clear DNS cache on macOS

- First we go to the magnifying glass located in the upper right part of the upper bar.
- In Spotlight, we write Terminal and open it.
- Next we must copy and paste the following command line:
sudo killall -HUP mDNSResponder; say DNS cache has been flushed
- Once we have copied and pasted this command line, we press Enter, we enter the password of our account on the Mac to allow the changes to be made (due to the use of the sudo command) and that's it.
Now we just have to wait a few minutes for the new DNS to take effect and all the cache has been completely emptied.