Skip to content

Flushing Your Local DNS Cache – Mac OS X

Last modified: September 12, 2023
You are here:
Estimated reading time: 1 min

Flushing your Mac’s DNS cache is probably something you’ve never thought of doing. And will probably never, ever need to do.

Unless you change web servers of course. Until your DNS cache has been updated, no matter how many times you refresh your web browser you are going to be sent to your old web server. This will happen on it’s own eventually, but the wait can sometimes be tortuous.

But don’t worry, clearing your Mac’s DNS cache is actually super simple.

  1. Open an application called Terminal, it’s located in Applications > Utilities > You can also type Command + Space to open the search interface. Just enter ‘Terminal’ and it should be the first result.
  2. Once Terminal is open you will see a command line prompt. Foropy and paste the following line:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

  3. You will be asked to enter your Mac’s admin password. Press Enter. Note that when you type your password nothing will appear on screen to indicate a password has been entered (no asterisk, no dots, absolutely nothing).
  4. Your DNS cache will be purged

Clearing the DNS cache on older versions of Mac OS X use the appropriate Terminal command listed below:

Mac OS X. VersionTerminal Command
macOS 12 (Monterey)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.14 (Mojave)sudo killall -HUP mDNSResponder
macOS 10.13 (High Sierra)sudo killall -HUP mDNSResponder
macOS 11 (Big Sur)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.15 (Catalina)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.12 (Sierra)sudo killall -HUP mDNSResponder
OS X 10.11 (El Capitan)sudo killall -HUP mDNSResponder
OS X 10.10 (Yosemite)sudo discoveryutil udnsflushcaches
OS X 10.9 (Mavericks)sudo killall -HUP mDNSResponder
OS X 10.8 (Mountain Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.7 (Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.6 (Snow Leopard)sudo dscacheutil -flushcache
Mac OS X 10.5 (Leopard)sudo lookupd -flushcache
Mac OS X 10.4 (Tiger)lookupd -flushcache
Was this article helpful?
Dislike 0
Views: 38