Clear DNS Cache on a Mac

There are a few different commands to use for flushing DNS cache on OS X and macOS depending on the version you are running.

As the procedure is the same on all versions, we will show how to clear DNS on macOS Mojave (10.14) and then list the commands for other versions in a table.

Flush DNS on macOS Mojave (version 10.14)

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

  1. Run the terminal.app 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 hit Return on your keyboard.
  3. Enter the administrator password for the account in question and hit Return.

There is no notification when the process finishes. However, you can append another command to change that.

Tip: If you want to hear an audio notification after the DNS flush is complete, type say some text after the first command, for example:
sudo killall -HUP mDNSResponder; say dns cleared successfully

Commands for Flushing DNS Cache on Older macOS and Mac OS X Versions