To clear the DNS cache on a Mac, you’ll need to open the native command-line interface known as Terminal and run the appropriate command. This process varies based on which version of macOS you’re running.
If you’re not sure what version you’re working with:
- Click on the “Apple” icon in the top-left corner of your desktop, and select ”About This Mac.”
- Your current version will be the first piece of information listed.
Once you know this information, you can follow the relevant steps below:
MacOS El Capitan 10.11 or above
If you’re working on macOS El Capitan 10.11 or above:
- Sierra (10.12),
- High Sierra (10.13),
- Mojave (10.14),
- Catalina (10.15),
Open the command line interface by clicking on Go > Utilities:
- Then, select Terminal. Once it opens, run the following command:
sudo killall -HUP mDNSResponder
- You’ll be prompted to enter your computer password.
After you’ve done so, your DNS cache should be clear.
MacOS Yosemite (10.10)
You can access Terminal by the same method described above for any macOS version. In Yosemite (10.10), once the window opens you’ll need to run the following command:
sudo discoveryutil udnsflushcaches
Enter your computer’s password and the DNS cache should successfully flush.
MacOS versions 10.7 to 10.9
For macOS versions 10.7 to 10.9, open up Terminal and run the following command to clear your DNS cache:
sudo killall -HUP mDNSResponder
You may notice that this is the same command used by versions 10.11 and above. Enter your password to execute it.
MacOS Snow Leopard (10.6)
If you’re running macOS Snow Leopard (10.6), open Terminal and input this command:
sudo dscacheutil -flushcache
Then, enter your password to finish clearing the DNS cache.
MacOS Leopard (10.5)
Finally, macOS Leopard (10.5) users should run the following command in Terminal:
sudo lookupd -flushcache
Once you enter your password, the DNS cache should be flushed.
Clearing your DNS cache is also the solution for fixing the ERR_SPDY_PROTOCOL_ERROR.
Flushing your DNS cache on a Windows computer is fairly simple. Here’s how to accomplish this task on Windows 10, 8, 7, and XP.
To clear your DNS cache on a Windows OS, you’ll need to open Command Prompt, the system’s command line interface:
- You can access this program in Windows 10 by clicking on the Start button.
- Then navigate to Windows Systems > Command Prompt.
- Once the command line interface is open, enter the following line:
This command should return a confirmation that the DNS cache has been successfully flushed.
- You can then close the Command Prompt window.
Clearing your DNS cache in older versions of Windows requires the same command
ipconfig /flushdns. However, the steps for accessing Command Prompt are slightly different between versions.
In Windows 8, open the Apps screen. On the far right side, find Windows Systems **and select Command Prompt.
Once the program opens, run
ipconfig /flushdns. You should receive a confirmation once the DNS cache has been cleared successfully.
Windows 7 and Windows XP
In Windows 7 or Windows XP, click on the Start button. Navigate to All Programs > Accessories and select Command Prompt.
In the command line interface, run
ipconfig /flushdns. You should receive a confirmation message once the DNS cache is flushed.
Flushing your DNS cache on Linux machines is fairly similar to the process of doing so on a Mac or Windows computer. Here’s how.
Linux uses Terminal as its command line interface, just like macOS. To open it, click on Activities in the top-left corner of your desktop This will provide you with a search bar, where you can enter “terminal” to find and launch the program.
Once the command line interface is open, execute this command:
sudo systemd-resolve --flush-caches
Terminal will then prompt you for your password. Enter it to finish executing the command and flushing your DNS cache.
If you’re using a Linux distribution other than Ubuntu, you can flush your DNS cache by opening your command line interface and running this command:
sudo /etc/init.d/dns-clean start
Once the command is executed, your cache should be clear.
Finally, as we mentioned at the beginning of this post, you may have cause to clear your browser’s DNS cache rather than your OS’s. In Google Chrome, you can do so by entering the following into the address bar:
Then click on the Clear host cache button.
This should flush Chrome’s DNS cache for you.