How to Flush the DNS Cache on Your Mac

Whenever an Internet connection issue occurs, the first thing that is going to be blamed is the internet browser, even though there are plenty of reasons that can cause issues in your connection. For instance, the DNS cache stored on your machine could be old and not able to retrieve the required websites for you. If that’s the case, you may need to flush it.

Flushing the DNS cache on a Mac running macOS is as easy as running a command through the Terminal window. All you need to do is launch the Terminal app and enter a command, and it will get the job done for you.

Flush DNS Cache on Mac

1. Click on Launchpad in your dock, search for and click on Terminal, and it will launch for you.

dnscache-terminal

2. When Terminal launches, type in the following command and press Enter. The command flushes the DNS cache on your machine.

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache flushed

dnscache-command

3. Since you are executing a “sudo” command, you will be prompted to enter the admin password of your machine. Do so and press Enter to move forward.

dnscache-password

4. Wait for your Mac to flush the DNS cache, and as soon as it is done, you will hear a message saying the cache has been flushed.

Instead of sending you a text notification saying the cache has been flushed, Terminal will tell you (of course, in machine language) that the said data was flushed.

Now that your DNS cache has been wiped, go ahead and open a website in a browser, and you should notice that it now properly resolves, and you are able to access it. If that happened, the trick worked for you.

Also, the above command should only work for Mac users that run OS X El Capitan or later. If you happen to be on an older version of macOS, the above command will not work, as there has been some internal changes in the OS files, thus making these commands invalid. However, a little Googling should definitely land you on a page telling you how you can flush the DNS cache on OS X Yosemite or any older versions.

Conclusion

If the DNS cache stored on your Mac is causing issues, the above guide should help you get rid of the issue by helping you wipe the entire DNS cache stored on your Mac.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Robert Zak

Tech writer at Make Tech Easier. Enjoys Android, Windows, and tinkering with retro console emulation to breaking point.