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:
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.
Follow the reactions below and share your own thoughts.