Mac OS X 10.6 - Clear DNS cache

Normally I wouldn't post something relatively trivial like this. However it came to my attention today that the Mac OS X may cache out-of-date DNS entries as long as the record is still valid according to its TTL.  I might not expect this behavior because the Mac is not running a DNS server and its resolv.conf points to an authoritative DNS server that is serving up-to-date data.

I would expect a copy of BIND or another caching DNS server to cache old records until the TTL expires, but not a normal network OS running a resolver client with a resolv.conf file etc.  I'm running Mac OS X 10.6.8.  Anyway, to clear the DNS cache on my mac, I typed this:

$ dscacheutil -flushcache

Curiously a google search of "mac os x flush dns" did not turn up that simple command, so I'm putting it on my blog for posterity.