Mac OS X – Clearing DNS Cache

Once you go to a Web site, or do any DNS lookup, the IP gets cached for quite a while. This becomes a royal pain if you’re a systems administrator who is in the middle of migrating domains from one server to another. Executing sudo killall lookupd lookupd -flushcache clears the cache, restarts the caching daemon, and fetches fresh DNS records. And there was much rejoicing…

Updated November 26, 2007: Thanks to Syd, the Leopard (Mac OS X 10.5) command has changed to dscacheutil -flushcache and lookupd has been deprecated.

Leave a comment