HomeApple MacOS X: Flush or Clear the DNS Cache

OS X: Flush or Clear the DNS Cache

The command used to flush the DNS cache changed in OS X 10.5 Leopard and later versions. The new command is just as easy to run, if not to remember. This article has been updated for all current versions of Mac OS X.


To improve performance in a networked operating system, DNS requests can be locally cached. This speeds up subsequent lookups for the same host name because a remote request is not required. The only problem with this is that the cache can get stale and hold values that are no longer valid. When this happens, you can sit on your hands and wait until the cache refreshes itself, or you can tell it to dump the values it has in it and look to remote servers for subsequent requests, refilling the cache.

This command does not require any special permissions to run and is a low-risk thing to do. You are not going to harm anything by running this command.

To clear the DNS cache, you will need to launch one of the following commands from the Terminal application based on your current version of OS X. You can start the Terminal application by searching for it with Spotlight or clicking on the Terminal application in the Utilities folder of your Applications folder.

OS X 10.5.2 including Leopard, Snow Leopard, and Lion.

dscacheutil -flushcache

OS X 10.5.1 and before

All versions of OS X prior to Leopard use lookupd to clear the cache.

lookupd -flushcache

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.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!