Save Yourself an Hour of Suicidal Frustration
Written by Michael on October 27th, 2006To clear your DNS cache on Mac OS X, open a terminal and type:
lookupd -flushcache
This can come in kinda handy if your a server administrator and are moving sites all over the internet and changing DNS on the root servers. Despite all of my experience, I was literally on the edge tonight trying to figure out why some sites weren’t resolving even though DNSstuff was pointing to the new server and running dig on the domain name showed the new ip as well. But in a browser, it would resolve to the old one. Clearing my browser cache, closing them and even rebooting did not help. Finally I got smart, logged into a server I have access to in a London datacenter and when I ran a ping on the domain, it resolved to the new ip.
Ran the command above and voila! I had this problem a long time ago and figure OS X must hang on it’s DNS cache for 12 hours. Now I just have a cron that runs that command every 30 minues.