Simmons Consulting, the Website of Toby Simmons

DNS cache in Leopard|Mavericks|Yosemite


Here is the best summary from

For Yosemite the command is

  1. sudo discoveryutil udnsflushcaches

For Mavericks, the commands are

  1. dscacheutil -flushcache; sudo killall -HUP mDNSResponder

For Lion & Mountain Lion the commands are

  1. sudo killall -HUP mDNSResponder

For Leopard & Snow Leopard the commands are

  1. sudo dscacheutil -flushcache

It looks like the dscacheutil is going to be a handy utility for web developing. Woohoo!

Update: Another useful thing is how to restart remote desktop from a command line:

  1. sudo /System/Library/CoreServices/RemoteManagement/ -restart -agent -console -menu

Remember that, too.

Update II (2008-06-14 12:42 p.m.): Another useful thing is how to restart MySQL (or other startup programs) from a command line:

  1. sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
  2. sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

Update III (2011-09-14 19:27:57): Another useful thing is now to compute directory usage from the command line. The syntax is a little different for OS X than other *nix-based languages. To display the usage of all subdirectories below the current directory (“-d 1” means depth of one):

  1. du -h -d 1 ./

I upgraded my Mac to Leopard yesterday and it is a beautiful operating system. My silver G5 runs fairly well, but bootup is considerably slower now. I was making some network changes today and had the need to flush my Mac’s DNS cache but had a hard time finding out how (without having to reboot, that is.)

After some frustrating searches (no, there is no lookupd command in Leopard) I finally found the answer thanks to ITToolbox.