I'm on OS X 10.9, according to support.apple.com I can flush the cache with
sudo killall -HUP mDNSResponder
Unfortunately this does not really refresh my DNS cache at all, also not like this:
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
E.g.
$ dig www.example.com|grep CNAME
www.example.com. 83955 IN CNAME example.com.
If cache were cleared it would be showing a number close to 86400, 3600, 300 or 60 are the TTL values offered by my domain name provider).
If I add @dns-host
to dig it works as expected:
$ dig @ns0.transip.net www.example.com|grep CNAME
www.example.com. 60 IN CNAME GITHUBACCOUNT.github.io.
I also tried the other commands on that page. In the meantime I work around this by ssh'ing onto one of my servers and check things there. But I'd like a proper way to really refresh all DNS cache on my Mac. How can I do that?
dig
bypasses the OS resolver (and hence cache), so this isn't telling you anything about whether it's been flushed or not. What it is telling you about is caching at your DNS server, and you cannot flush that from the client.