FacebookTwitterLinkedIn

How to Clear the DNS Cache in MacOS Sierra or Later?

How to Manually Clear the DNS Cache on a Mac Computer Running macOS Sierra or Later?

DNS settings are responsible for translating domain names to Internet Protocol (IP) addresses. Without DNS servers, you would have to remember the IP address of each website. For example, rather than typing www.apple.com in the Internet browser, you would have to type 17.172.224.47 - obviously, not very convenient.

dns-cache-introduction

There are situations when you will need to clear DNS cache, such as to ensure that the name server responds correctly. Also, if you have made changes in the /etc/ hosts file, you must clear the DNS cache for them to take effect. This last point is not often mentioned in many guides - changes might not take effect until the DNS cache is reset.

Restarting the Mac will often clear the DNS cache. However, there are cases when a reboot is not an option. In this guide, you'll find out ways you can clear the DNS cache on your Mac.

Video showing How to Reset DNS Cache on macOS Sierra or Later?

Table of Contents:

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

1. Launch the Terminal application by using Spotlight. Press Command and Spacebar, or through the Finder, go to Applications, and then Utilities.
2. Next, type the following command (if possible, copy-and-paste or type it carefully, since upper/lower case and space errors will invalidate the command): sudo killall -HUP mDNSResponder; say DNS cache has been flushed
3. Press the return key and, since you are using the sudo (superuser) permissions, enter your administrator account password to confirm the action.
4. Wait a few moments until you hear an audio alert announcing that the DNS cache has been flushed when the process completes. This will apply to the changes made to DNS settings or /etc/ host files.

flush-dns

[Back to Table of Contents]

An alternative method to reset DNS cache on Mac computers

In some cases, you might need to quit and relaunch any active applications using the DNS or network such as Safari, Chrome, Firefox, Opera, sFTP, SSH, and any similar tasks relying on domain name correspondence. This particular command can fail, but this is not a significant issue since an alternative command is available in newer versions (Sierra 10.12.3 and above) of macOS.

1. Launch the Terminal app.
2. In the Terminal window enter the command: sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache; say MacOS DNS cache has been cleared3. Press the return key to execute, and confirm the action with the administrator's password.

flush-dns-2
Note: this step is based on modern versions of macOS such as Sierra 10.12 and later. The methods on earlier versions vary slightly.

[Back to Top]

▼ Show Discussion

About the author:

Karolina Peistariene

Author of how-to guides for Mac users. Responsible for collecting, analyzing, and presenting problem-solving solution articles related to macOS issues. Years of macOS experience combined with solid research and analyzing skills help Karolina provide readers with working and helpful solutions as well as introduce various features Mac has to offer. Contact Karolina Peistariene.

Our guides are free. However, if you want to support us you can send us a donation.

About PCrisk

PCrisk is a cyber security portal, informing Internet users about the latest digital threats. Our content is provided by security experts and professional malware researchers. Read more about us.

Malware activity

Global malware activity level today:

Medium threat activity

Increased attack rate of infections detected within the last 24 hours.