I know I can manually flush the DNS cache, e.g. with sudo killall -HUP mDNSResponder.

But how long will the cache last if I don't do this? Does it reset on a reboot?

1 Answer 1


You can flush the local DNS cache with the following command:

dscacheutil -flushcache

How long a DNS entry is cached typically depends on the TTL of that DNS record, which is configured by the DNS admin of the relevant hostname.

You can find out the (remaining) TTL of any given DNS record with the dig command:

dig apple.stackexchange.com

In the answer section you'll see the remaining TTL right next to the hostname (in this example 257 seconds).

apple.stackexchange.com. 257    IN  A
  • Not quite. This shows the TTL on the DNS server you queried. Since the DNS server you're using is probably not StackExcahnge's authoratative server, you're seeing its cache tick down. If you query its authoratative server (e.g. dig @ns-925.awsdns-51.net apple.stackexchange.com, you'll see a number that never changes (300, in this case)
    – David C.
    Aug 24, 2021 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .