How to Flush DNS Cache in Mac OS X

Are you a web developer migrating domains, or a systems admin doing maintenance and need to flush the DNS cache on your machine to get things all in order? If you’re running Mac OS X, it’s actually pretty easy and only requires a simple command within your Terminal window. Depending on which version you’re running, just following the directions below:

Flushing DNS Cache in OS X Lion (10.7) and OS X Mountain Lion (10.8)

Launch Terminal and enter the following command. You’ll then be prompted to enter your administrative password, after which the command will automatically run.

sudo killall -HUP mDNSResponder

Note the dscacheutil still exists in 10.7 and 10.8, but the official method to clear out DNS caches is through killing mDNSResponder. You can also find that process running in Activity Monitor.

Flush DNS Cache in Mac OS X 10.5, Mac OS X 10.6

Launch Terminal and issue the following command. You’ll then be prompted to enter your administrative password, after which the command will automatically run.

dscacheutil -flushcache

Flush your DNS Cache in Mac OS X 10.4 Tiger

Type the following command in the Terminal. You’ll then be prompted to enter your administrative password, after which the command will automatically run.

lookupd -flushcache

All done! Your DNS cache should now be flushed!