If you’re having difficulty connecting to a particular website or encountering DNS errors on your Mac, a DNS flush could help. DNS, short for Domain Name System, is the process of converting a hostname to an Internet Protocol (IP) address. The DNS cache is a collection of these translations saved on your device to speed up the process. Occasionally, these might cause problems, so flushing the DNS can be a handy troubleshooting step. Here’s how you can do it.
Flushing DNS on MacOS 10.10.4 and above
For users on MacOS 10.10.4 and above, you can flush the DNS cache by using the following command in the Terminal:
sudo killall -HUP mDNSResponder
The Terminal can be found under the Utilities folder in Applications. After typing the command, hit return, then type your password when prompted and hit return again.
Flushing DNS on MacOS 10.10.1, 10.10.2, and 10.10.3
Users on MacOS 10.10.1, 10.10.2, and 10.10.3 should instead use the following command:
sudo discoveryutil mdnsflushcache
Enter this command in the Terminal, then hit return. You’ll be prompted for your password. After typing your password, hit return again.
Verifying the DNS Flush
To make sure the DNS flush was successful, you can run the following command:
sudo killall -INFO mDNSResponder
This command will return a list of the cached DNS entries, if any. If the flush was successful, no entries should be listed.
That’s it. You’ve successfully flushed the DNS cache on your Mac. Whenever you’re having trouble accessing certain websites or networks, remember that a DNS flush can potentially solve the problem.