HomeApple MacMac networkingMac OS X: Clear the DNS cache

Mac OS X: Clear the DNS cache

Mac OS X uses the lookupd system to keep a cache or local database of DNS lookup results (among other things). This can substantially increase performance by preventing repeated DNS queries. However, there are times such as moving a web server or troubleshooting networking or DNS server problems when the cached data can be a problem. A simple command will clear the cached values.

To clear the lookupd cache, use:

lookupd -flushcache

To run this command, open a Terminal window (in a Finder windows Applications -> Utilities -> Terminal) and just type in the command as shown above. This is a low-risk command. The data stored in lookupd’s cache are temporary by design. By default, an entry will only stay in the cache for 12 hours.

If it seems like this doesn’t work, it is possible that the application you are testing with also caches its DNS queries. For example, the Firefox browser caches DNS entries internally for 60 seconds. In this case, the easiest solution is to sit on your hands for a minute.

Note: this command changed for version 10.5 (Leopard) of OS X. For the new command, see this recipe.

Quinn McHenry
Quinn McHenry
Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.


Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments

error: Content is protected !!