Insights

How to clear the DNS cache on macOS

Clear your Mac’s DNS cache with one Terminal command on macOS Sonoma or newer, or restart. Retry the same hostname in the original app.

Illustration of aluminum iMac with pull-out cache drawer.
On this page

To clear the Domain Name System (DNS) cache on macOS Sonoma or newer, open Terminal and run the mDNSResponder command below. Namefi reports this procedure from UCSF's IT team: enter your administrator password if prompted, then retry the same name in the app that had trouble. Apple's archived guidance also gives restarting your Mac as a way to refresh cached DNS information.

In short:

  • Run one command. Use the reported Terminal procedure on macOS Sonoma or newer.
  • Restart instead. Save your work and restart your Mac to refresh cached DNS information.
  • Retry the same name. Check whether the original app now reaches the right service.

Run the flush command for your Mac

1. Check your macOS version and note what failed.

Write down the exact hostname, the name the app is trying to reach. Note which app failed and what happened. If you know the address the name should point to, note that too.

2. On macOS Sonoma or newer, open Terminal and run this command once.

sudo killall -HUP mDNSResponder

Enter your administrator password if prompted. If Terminal reports an error, keep the message and check your macOS version and the command before retrying.

3. Restart instead if you want to skip Terminal.

Save your work, then restart your Mac. If you've seen advice to run dscacheutil too, Apple's archived instruction for that command was for Snow Leopard. It isn't an extra step in the reported procedure for Sonoma or newer.

Check whether the same name works now

Without changing networks or DNS settings, retry the exact hostname in the original app. If the service opens as expected or the app shows the address you expected, stop there. That shows the original symptom cleared, not which layer held the old answer. A quiet Terminal prompt by itself doesn't show that the cache was cleared.

When you still get the old answer

Flushing the cache can help when your Mac is holding on to an old answer. It won't change the published DNS record or erase a copy held by an upstream resolver, the server that answers DNS lookups for your device.

Before flushing again, try the same hostname in another app on the same network. If only the original app fails, check whether it keeps its own DNS answers or sends lookups to a different resolver. The difference is a clue to check the app, not proof that it cached the old answer.

If several devices on the same network still get the old address, ask whoever manages your DNS to compare the resolver's answer with the published record. For private names, keep using the approved resolver instead of switching to a public one as a test.

Where doxx.net fits. doxx.net encrypts DNS lookups and blocks unwanted domains, which is a separate job from clearing your Mac's cache. If you're looking for those DNS features, you can download the doxx.net app.

Ask an AI assistant

Share this article

Private Everywhere

Stop giving the internet everything

Keep your browsing, messages, files, and agents private.