How to flush DNS on macOS

Learn the steps to successfully flush the DNS cache on all versions of macOS for quicker loading of websites.

Written By Lorenzo Vincent

Updated at January 5th, 2024

The commands used for flushing DNS cache on macOS vary depending on the version being used. However, the process remains consistent across all versions. Therefore, this article outlines the steps for clearing DNS cache on macOS Mojave (10.14) and presents a table listing the commands for other versions.

To clear DNS cache on macOS Mojave, use the Terminal application:

  1. Run using your preferred method. You can launch the app from Applications -> Utilities or press Command + Space to launch Spotlight and search for Terminal.
  2. Type in sudo killall -HUP mDNSResponder and press Return on your keyboard.
  3. Enter the administrator password for the account in question and press Return.

Flush DNS Commands on Older macOS and Mac OS X Versions

The table below lists the commands for clearing the DNS cache on most macOS and Mac OS X versions. You can copy and paste them directly from the table into your terminal.

macOS version Terminal Command
Mojave (version 10.14)
High Sierra (version 10.13)
Sierra (version 10.12)
Mountain Lion (version 10.8)
Lion (version 10.7)
sudo killall -HUP mDNSResponder
El Capitan (version 10.11)
Mavericks (version 10.9)
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
Yosemite (version 10.10) sudo discoveryutil mdnsflushcache
sudo discoveryutil udnsflushcaches
Snow Leopard (version 10.6)
Leopard (version 10.5)
sudo dscacheutil -flushcache
Tiger (version 10.4) lookupd -flushcache