---
title: "How to flush the DNS cache on Mac (Terminal command) · Kilobat Guides"
url: "https://kilobat.app/guides/flush-dns-cache-mac"
description: "Clear the macOS DNS cache with Terminal after a site moves or a “server not found” error stays. See when a flush helps and when it does not."
---

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.

Applies to: OS X 10.10.4 Yosemite and later, which includes all current macOS versions. · Checked: 29 October 2026

## Symptoms

- A site moved to a new server, but the Mac still goes to the old address.
- A change to `/etc/hosts` or 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

1. Ask the macOS resolver for the name. Compare the address with the address that you expect.

   ```
   dscacheutil -q host -a name example.com
   ```
2. Show the DNS servers that macOS uses.

   ```
   scutil --dns
   ```

## How to fix it

1. Open Terminal. Clear the Directory Service cache.

   ```
   sudo dscacheutil -flushcache
   ```

   Needs an administrator password.
2. Tell mDNSResponder to clear its cache. Apple gives this command for OS X 10.10.4 and later.

   ```
   sudo killall -HUP mDNSResponder
   ```

   Needs an administrator password.
3. Type your password when Terminal asks. The commands show no message when they work.
4. Quit and open the browser again, so that it does not use its own old answers.
5. Look up the name again. If the old address comes back, the DNS server still has it.

## With Kilobat

1. The CLI runs the same two commands. macOS asks for an administrator password.

   ```
   kilobat dns flush
   ```
2. In the app, open the Health tab and click Flush cache… in the DNS panel.
3. The MCP tool `set_dns` with `provider` set to `flush` does 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](https://support.apple.com/en-us/101481)
- 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.

## Related guides

- [DNS not resolving on a Mac](https://kilobat.app/guides/dns-server-not-found): When DNS fails, the Mac cannot change a name such as apple.com into an IP address.
- [Changes to /etc/hosts do not work on a Mac](https://kilobat.app/guides/hosts-file-not-working): The /etc/hosts file maps names to IP addresses on this Mac only.
- [Slow DNS on a Mac](https://kilobat.app/guides/slow-dns-mac): Every new site needs a DNS lookup before it can load.
- [Safari can’t find the server on a Mac](https://kilobat.app/guides/safari-cant-find-server): “Safari can’t find the server” usually means that the Mac could not get an address for the site name.
- [What is mDNSResponder on Mac?](https://kilobat.app/guides/what-is-mdnsresponder): mDNSResponder answers DNS lookups for every app on the Mac, and it runs Bonjour on the local network.
