Clearing DNS Caches in Early Versions of Mac OS X (10.3, 10.2, 10.1)
Anytime you visit a website or do any other kind of DNS lookup, the IP address conveniently gets cached. While what’s convenient for most of us can be a real nuisance for others, particularly administrators who are moving around servers. This set of quick tips that Systems Administrators (and others) will surely appreciate covers flushing DNS caches in early release versions of Mac OS X system software, like 10.4, 10.3, 10.2, 10.1, and 10.0 (!).
If you’re on a new version like OS X 10.10.x Yosemite or later, don’t worry, we’ll link to how to do the DNS dump there too.
First off, clearing the DNS cache in Mac OS X always requires to be done from the Terminal. The command is what changes in versions of OS X. Thus, use the following commands depending on the version of OS X in use on the system.
Clearing DNS in Old Releases of Mac OS X like 10.4, 10.3, 10.2
In versions of Mac OS X as far back as Mac OS X 10.4, Mac OS X 10.3, Mac OS X 10.2, Mac OS X 10.1 you can use the simple lookupd command:
No other work is required, the DNS will dump its cache and that’s it.
Apple changed things in later versions of Mac OS X however, with Mac OS X 10.5 Leopard you would need to use the dscacheutil and this syntax instead:
Again once you hit return that’s it.
As you’ve probably guessed, later versions of OS X changed YET AGAIN how to flush out the DNS cache on nearly every version of Mac OS X that Apple has put out.
- Flushing DNS caches in OS X Yosemite (10.10.x) and newer with discoveryutil
- Flushing DNS cache in OS X 10.9 Mavericks, 10.8 Mountain Lion, 10.7 Lion, 10.6 Snow Leopard
It’s possible that Apple will adjust DNS configuration again in the future so be sure to bookmark OSXDaily.com, we’ll be sure to cover it.
The IP got changed on a site I was working with and I tried the command dscacheutil -flushcache it seemed to work but the DNS did not flush. I still cant view the site.
Also have this problem. . and also no idea how to fix it. .
i run dscacheutil -flushcache.. it gives me a “command not found” error
i also tried lookupd -flushcache, “command not found”
i did th whese while running in DVD OS X Leopard.
Hello every one,
I’m having an annoying problem since 3 days, I can not connect to any google domain and a few others (yahoo), using Leopard…
I ran dscacheutil -flushcachel and it didn’t help :-(
Could anyone help me please?
hmills, I happen to use this every day, multiple times a day.
I do web development work and I have a local web server running on my laptop. I have an automator script which swaps my hosts file to point to the “real” site or my local development site with one click. At the end of the script, I clear the DNS cache. That way I can switch back and forth.
Example situation where it might make sense :
Your office server has a domain name (mycompany.com), but the company’s ISP decides to change the IP address associated with your office’s internet connection. For a short while (may be as short as 2 hours, but as long as 2 or more days), all DNS requests for mycompany.com will still resolve to the old IP address (because of caches), thus making the new address totally unreachable by DNS name.
If you clear your local DNS caches, it might then resolve to the new address.
That is unless your ISP doesn’t cache itself the DNS results. In that case, your last resort is to modify your /etc/hosts file to manually override the IP address associated with “mycompany.com”.
dscacheutil replaces lookupd in leopard. So it just becomes dscacheutil -flushcachel
unfortunately no longer in leopard…. :-/
[…] Rychlý tip: čištění dns cache lookupd -flushcache zdroj: os x daily […]
I don’t think I’ve come across an instance where I would need this, but good to know