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
- How to AirDrop from iPhone to Mac
- How to Back Up a Mac with Time Machine
- How to Change the Default App for a File Type on Mac
- How to Change the Default Browser on Mac
- How to Check Memory Usage on Mac
- How to Check Which macOS Version You Have
- How to Connect AirPods to a Mac
- How to Find Your IP Address on Mac
- How to Force Quit an App on Mac
- How to Free Up Storage on Mac
- How to Generate an SSH Key on Mac
- How to Record Your Screen on Mac
- How to Rename Multiple Files at Once on Mac
- How to Show Battery Percentage on Mac
- How to Show Hidden Files on Mac
- How to Take a Screenshot of Part of the Screen on Mac
- How to Uninstall an App on Mac
- How to Use Split Screen on Mac
- How to Zip and Unzip Files on Mac
- How to Check If a Port Is in Use on Mac