How to clear the DNS Cache in MacOS Sierra?

How to manually clear the DNS cache on a Mac computer running macOS Sierra or later?

Managing DNS settings, sometimes is useful a solution, when encountering connection issues. Most commonly DNS settings are manged by network or system administrators or web developers. DNS stands for domain name system, DNS settings are responsible for translating domain names to Internet Protocol (IP) addresses. If there would be no DNS servers Internet users would have to remember the IP address of each website, for example instead of typing in your Internet browser you would have to type And that is not very convenient. One of the most popular cases when you would want to clear DNS cache is when you seek that name server respond properly. Also if you made changes in /etc/ hosts file to achieve the effect you will have to clear the DNS cache.  Frequently, if you're following some how to do guides, authors don't mention, that changes may not take an effect until you reset the DNS cache.

To clear DNS cache it is usually enough to restart your Mac, however there are cases when reboot is not an option. Clearing DNS cache settings is not a very difficult task, but since it includes using command line it may look confusing and frustrating, especially if you're not familiar with using Terminal and it's commands. It is important to mention, that commands and the whole procedure varies with every version of Mac's operating system - this guide will show you how to reset DNS cache on macOS Sierra operating system.


Table of Contents:

How to clear DNS cache on computers running on MacOS Sierra or later

To begin the process, first launch the Terminal application by using spotlight, hit Command and Spacebar, or through finder going to Applications and then to Utilities. Next type in the following command, if possible copy and paste it or type it carefully since upper and lower case and space may result that your command became invalid. sudo killall -HUP mDNSResponder;say DNS cache has been flushed
Press the return key and enter your administrator account password to confirm your action, because you're using the sudo (super user) permissions. Further, you have to wait a few moments until you hear an audio alert, announcing that DNS cache has been flushed when process completes. This process will help you to achieve the effect of your changes you made to DNS settings or /etc/ host files.


[Back to Table of Contents]

Alternative method to reset DNS cache on Mac computers

What is more, sometimes you may need to quit and relaunch any active applications that are using DNS or network, such as Safari, Chrome, Firefox, Opera, sFTP, SSH and any similar tasks relying on domain name correspondence. Rarely this particular command may end up failing, but this is not a big deal, since there is an alternative command which is available in newer versions (Sierra 10.12.3 and above) of macOS. Type in:

sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache;say MacOS DNS cache has been cleared

Press the return key to execute, and confirm the action with administrator's password.

Note: this step is based on modern version of macOS such as Sierra 10.12 and newer. The methods on earlier versions varies slightly.

[Back to Table of Contents]

Video Showing how to reset DNS cache on a Mac computer running MacOS Sierra or later:

[Back to Top]