If you are a macOS user and have recently made changes to your DNS settings, then doing a flush, aka cleaning the DNS cache would be a good idea. But why is it important to clear DNS cache?
Well, simply because when your DNS is cached, nameservers or domain name may not resolve to the correct IP and may lead you to a cached website, or worst, it’ll be unable to establish a connection.
In this post, I will guide those who’ve recently upgraded to macOS Mojave, the process of resetting your Mac’s DNS cache. Let’s check it out.
Launch Terminal app. You can do it swiftly by executing this keyboard shortcut Command + Space. Then type in Terminal, then hit Enter.
Copy the following command into Terminal, and hit Enter.
sudo killall -HUP mDNSResponder; sleep 2;
Enter your macOS’s password, and hit Enter again.
Quit Terminal by using the keyboard shortcut: Command + Q.
That’s it, simple as that. Your DNS cache should now be cleared.
Now, if you are using older versions of macOS, targeting the
mDNSResponder process using the above command may not work.
Reset DNS Cache in older macOS
Check out this post for commands on clearing DNS cache on older versions of macOS.