DNS, or a Domain Name System, is basically what resolves website names into their respective IP addresses. So, if you are encountering an issue on your Mac where the name server is not resolving properly, or if you want a DNS change to be noticed by your system, you might have to reset and flush the DNS cache in macOS Sierra. This can also come in handy, if you have made edits to your /etc/hosts file, and you want the changes to register without having to reboot your Mac. So, if you want to reset and flush the DNS cache on your Mac, here is how to do it:
Reset and Flush/Clear DNS Cache in macOS Sierra
The procedure to reset and flush aka clear DNS cache in macOS is actually very easy. All it requires is for you to enter one command in the Terminal, and you’re done. Well, technically, it’s two commands in one line. If you want to flush DNS cache on a Mac, simply follow the steps below:
1. Launch Terminal, and type “sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder“.
2. You will be prompted to enter a password. Enter your Mac login password here, and hit Enter.
Great, you have successfully reset, and flushed the DNS cache on macOS Sierra. If you were encountering any issues with name servers, and such, they should now get resolved. You can try and do a “dig“, or an “nslookup” on a website you want, to see if your DNS issues have resolved.
Using dig to Check Query Times
Often, if your DNS settings are messed up, or if you have a DNS that is simply too slow, you might be left wondering what is going on. To check whether your DNS is working fine, you can use the “dig” command in the Terminal:
1. Launch Terminal, and type “dig beebom.com“. You can use the name for any website in place of beebom.com.
2. In the results, you can check the “Query time“. If you find that the query time for the website is too high, you should change macOS’s DNS settings, and set a DNS server like Google DNS.
Once you have changed the DNS server, you can run the dig command again, to check if there has been any improvement. Unless there is an issue with your ISP, changing DNS to Google DNS, or OpenDNS should really help.
Reset and Flush DNS Cache to Fix DNS Issues
You can reset and clear DNS cache in macOS Sierra to fix most DNS issues that you might be facing. The method mentioned in the article works for Mac OS X 10.10.4+, and even on macOS Sierra. If you face any issues with the commands I mentioned, feel free to let me know in the comments section down below.