DNS
Flush the DNS cache on a Mac
macOS keeps DNS answers for some time. A flush removes them, so that the next lookup asks the DNS server again.
Symptoms
- A site moved to a new server, but the Mac still goes to the old address.
- A change to
/etc/hostsor to a DNS record does not show. - A “server not found” error stays after the network works again.
Likely causes
- Cached answers. mDNSResponder keeps a cache of DNS replies. The cache can hold an answer that is no longer correct.
- The browser cache. Some browsers keep their own DNS cache. A macOS flush does not clear it.
- The DNS server cache. The router or the provider also keeps answers. A flush on the Mac does not clear them.
How to check
Ask the macOS resolver for the name. Compare the address with the address that you expect.
dscacheutil -q host -a name example.comShow the DNS servers that macOS uses.
scutil --dns
How to fix it
Open Terminal. Clear the Directory Service cache.
sudo dscacheutil -flushcacheNeeds an administrator password.
Tell mDNSResponder to clear its cache. Apple gives this command for OS X 10.10.4 and later.
sudo killall -HUP mDNSResponderNeeds an administrator password.
Type your password when Terminal asks. The commands show no message when they work.
Quit and open the browser again, so that it does not use its own old answers.
Look up the name again. If the old address comes back, the DNS server still has it.
With Kilobat
The CLI runs the same two commands. macOS asks for an administrator password.
kilobat dns flushIn the app, open the Health tab and click Flush cache… in the DNS panel.
The MCP tool
set_dnswithproviderset toflushdoes the same. It tells the agent to ask you first.
Questions
Does a flush make DNS faster?
No. It removes old answers. The next lookups go to the DNS server again, so they can be a little slower.
Is it safe to flush the DNS cache?
Yes. macOS fills the cache again as apps look up names. The dscacheutil man page says to use its flush only when necessary.
Do I need to restart the Mac?
No. The commands take effect at once.
Sources
- Apple Support (archived): Reset the DNS cache in OS X
- dscacheutil(1), man page installed with macOS 27.2
- mDNSResponder(8), man page installed with macOS 27.2
Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.