This article explains how to delete the DNS cache on a Mac.
If you're experiencing internet connectivity issues, you may be able to fix them by resetting the DNS cache with a Terminal command. It should only take a few moments.
Open Terminal. One quick way is to pressCommand+Spaceto launch Spotlight. Then, typeTerminaland select it from the results.
You can also access Terminal by navigating toGo>Utilities>Terminal.
Type (or copy and paste) this command into Terminal and then pressEnter:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
This command only works in macOS 10.12 Sierra and newer. If you have an older version, check the next section for the correct command.
Type your password and then pressreturn. The DNS cache will be reset immediately, but there will be no message to that effect. When a new line appears, it indicates the command has been carried out.
The password will not appear in Terminal as you type it.
The Mac OS X flush DNS command is different than the one used in modern versions of the operating system. Open Terminal and then enter the command that corresponds with your version:
Each time you access a website in your web browser, the URL you enter is sent to a DNS server for translation into an IP address. This information is stored in a cache on your Mac for easy retrieval in the future, hence the termDNS cache.
When you try to access a website you've been to recently, your Mac uses its DNS cache instead of checking with an actual DNS server. The web browser doesn't have to go through the extra step of communicating with a remote DNS server, which results in less time between entering a website address and the website loading.
If the local DNS cache is corruptoroutdated, it's kind of like trying to use an old phone book that's been vandalized. Your web browser checks the cache to find an IP address for the website you're trying to visit, and it finds either the wrong address or an unusable one. This can slow the process down or prevent websites or specific web page elements, like videos, from loading.
When you flush your DNS cache, you instruct your Mac to delete its local DNS records. This in turn forces your web browser to check with a DNS server for fresh information. You should always flush your DNS cache after changing the DNS servers on your Mac. It can also be helpful if you're having connectivity problems.
Open the built-in Console log-viewer app on your Mac and typeany:mdnsresponderinto the search bar. Then, launch Terminal, type insudo killall -INFO mDNSResponder, and pressEnter or Return. Back in the Console app, you can view a list of cached DNS records.
To clear the DNS cache on Windows 10, open the Run dialog box, type inipconfig /flushdns, and clickOK. You can also use the same command in the Windows command prompt if you want more information on the process.
DNS cache poisoning, also known as DNS spoofing, is when someone deliberately enters false or incorrect information into a DNS cache. After the false information is input, future DNS queries will return incorrect responses and direct users to the wrong websites.