# How to Clear the DNS Cache on Mac

> The Terminal command that clears the macOS DNS cache, when flushing helps, and when a proxy, VPN, browser or /etc/hosts is the real cause.

Published: 2026-10-11 | Updated: 2026-10-17

To clear the DNS cache on a Mac, open **Terminal** from **Applications › Utilities** and run:

```shell
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
```

Enter your Mac login password when asked. Nothing is printed when it works. Restarting the Mac clears the cache too: [Apple's DNS cache article](https://support.apple.com/101481) says you can restart your Mac to update its cached information.

That Apple article is archived and no longer updated. Its newest entry, for OS X Yosemite 10.10.4 and later, is `sudo killall -HUP mDNSResponder`; `dscacheutil -flushcache` is the command it lists for Snow Leopard. Apple has not published a newer version, so the line above runs both: the `killall` part is the one Apple lists for current releases, and `dscacheutil -flushcache` flushes the Directory Service cache according to its manual page (`man dscacheutil`), which also says to use it only in extreme cases. A stale DNS answer is one of those cases. Mole Mac does not flush DNS; this is a Terminal task.

## What the DNS cache is

When an app connects to `example.com`, macOS first has to turn that name into an IP address. On a Mac, that lookup goes through `mDNSResponder`. Its manual page (`man mDNSResponder`) describes it as the daemon that performs DNS queries on behalf of other processes and keeps a cache of the replies.

The cache saves a round trip on every repeated lookup. Each answer is kept for the time the domain's DNS records allow, then fetched again. Most of the time that works without anyone noticing. It goes wrong when the cached answer is out of date before it expires: a site moved to a new server, you changed DNS servers, or a lookup failed once and the failure is still being reused.

`-HUP` in `killall -HUP mDNSResponder` chooses which signal `killall` sends; without it, `killall` sends TERM (`man killall`). Apple lists the HUP form as the way to reset the DNS cache, so do not drop the flag or replace it with `-9`.

## When flushing DNS helps

| Situation | Why flushing helps |
|---|---|
| A website or server moved and your Mac still reaches the old address | The cached answer has not expired yet |
| You changed the DNS servers in Network settings | Old answers from the previous servers are still cached |
| You edited `/etc/hosts` and the change is ignored | The `hosts` manual page says the file is read by mDNSResponder, which may still hold the earlier answer |
| A site failed to resolve a minute ago and still fails even though other devices reach it | A failed lookup may be cached |

## When it does not help

Flushing only clears the Mac's own resolver cache. Several common setups make it irrelevant:

- **Proxy.** If traffic goes through an HTTP or SOCKS proxy, the proxy often resolves names itself. Check with `scutil --proxy`, which reports the current system proxy configuration.
- **VPN.** A VPN can install its own DNS servers or route only some domains to them. `scutil --dns` shows every resolver in use; supplemental resolvers that list a domain are used only for that domain. If a work domain fails, the VPN's DNS is the place to look.
- **The browser's own cache.** Browsers can keep their own short-lived DNS results and reuse open connections. After flushing, quit the browser completely and reopen it, rather than only reloading the tab.
- **Upstream caches.** Your router and your DNS provider cache answers too. Flushing the Mac cannot make them fetch a new record sooner.
- **The site is actually down,** or blocked on your network. If other devices on a different network also fail, DNS on your Mac is not the cause.

If pages are slow rather than failing, DNS caching is rarely the bottleneck. [Mac WiFi stutters](https://mole.fit/blog/mac-wifi-stutter-awdl) and [Which app is using my network](https://mole.fit/blog/what-app-is-using-my-network-mac) cover more likely causes.

## Check what your Mac actually resolves

Use the system resolver to see the answer your apps get:

```shell
dscacheutil -q host -a name example.com
```

The `dscacheutil` manual page says `-q` runs a query through the standard calls, returning cached results or fetching live data.

Then ask a DNS server directly:

```shell
dig example.com
```

`dig` does not go through the macOS resolver. Its manual page says it uses the servers listed in `/etc/resolv.conf`, and that file on macOS carries a notice that it is not consulted for the DNS resolution used by most processes on the system. If `dig` returns the new address and `dscacheutil` returns the old one, the Mac's cache or its resolver configuration is the difference, and a flush should fix it. If both return the old address, the record has not changed upstream yet.

To see which DNS servers the Mac is using:

```shell
scutil --dns
```

The servers you set by hand are in **System Settings › Network**: select a network service, click **Details**, then **DNS** ([Apple](https://support.apple.com/guide/mac-help/change-dns-settings-on-mac-mh14127/mac)).

## Check /etc/hosts before blaming the cache

`/etc/hosts` overrides DNS for any name it lists. Development tools, ad blockers and old tutorials sometimes add lines there and leave them. To read it:

```shell
cat /etc/hosts
```

A normal file has only a few lines for `localhost` and comments starting with `#`. If you see the domain that is misbehaving, that line is why it resolves the way it does. Edit only that line, with an editor run through `sudo`, keep a copy of the original, then flush the cache. Do not delete the `localhost` entries.

## Verify the result

1. Run the flush command.
2. Run `dscacheutil -q host -a name example.com` again with the problem domain and check the address.
3. Quit and reopen the browser or app that had the problem.
4. If it still fails, compare with `dig`, `scutil --dns` and `scutil --proxy` to see which layer is answering.

## What not to do

- Do not flush DNS on a schedule or as a speed tweak. A warm cache makes lookups faster, and an empty one makes the next few slower.
- Do not delete `/etc/hosts` or change its permissions.
- Do not switch DNS servers on a work or school Mac that uses a VPN or management profile without checking with whoever manages it; internal names may stop resolving.
- Do not change proxy or VPN settings to "test DNS". Find out which layer answers first.

## FAQ

### How do I clear the DNS cache on a Mac?

Run `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder` in Terminal and enter your password. Restarting the Mac also clears it.

### What is the command to flush DNS on current macOS?

Apple's archived article lists `sudo killall -HUP mDNSResponder` for OS X 10.10.4 and later, and Apple has not published a newer one. Running `sudo dscacheutil -flushcache` first as well is common; it only clears cached data.

### Does flushing DNS on a Mac clear the browser's cache?

No. It clears the macOS resolver cache only. Quit and reopen the browser so it does not reuse its own DNS results or open connections.

### Why does a site still go to the old address after flushing?

Check `/etc/hosts`, a proxy or VPN, and whether `dig` shows the new address. If the DNS record has not changed upstream yet, no local flush can help.

### Can Mole flush the DNS cache?

No. Mole Mac does not include a DNS flush; run the Terminal command above or restart the Mac.

---

Canonical HTML page: https://mole.fit/blog/how-to-flush-dns-cache-mac
Blog index for agents: https://mole.fit/blog/llms.txt
Site index for agents: https://mole.fit/llms.txt
