How to Flush the DNS Cache on Mac

Clear your Mac's DNS cache with one Terminal command so it stops using stale addresses after a domain or server change.

Your Mac remembers which IP address each domain name points to. After you move a site to a new host or change DNS records, that memory can be wrong for a while. Flushing the cache forces a fresh lookup.

Run the flush command in Terminal

Open Terminal (Applications, Utilities, Terminal) and paste:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Press Enter and type your Mac password when asked. Nothing prints on success. The first part clears the directory service cache; the second restarts the DNS responder so it forgets everything it knew.

This works on every macOS release from Sierra onward, including the current one.

Confirm the new address is being used

Ask your Mac what it now resolves the domain to:

dig +short yourdomain.com

If it shows the new IP, you are done. If it still shows the old one, your Mac is fine and the stale answer is coming from further upstream.

Clear the browser's own cache if it still misbehaves

Chrome keeps its own DNS cache. Paste this into the address bar and click Clear host cache:

chrome://net-internals/#dns

Safari uses the system cache, so the Terminal command already covered it.

If it still resolves to the old address. Your router or ISP is caching it too. Restarting the router clears the router. For the ISP, you can only wait for the record's TTL to expire, typically an hour or less.

More Mac how-tos