HOWTO: Flush DNS cache on Mac OS X

Had some strange behaviour with DNS on Mac OS X earlier today. Made a change inside DNS and waited the required amount of time for the TTLs to expire. Then verified that the new IP address was resolving (using both dig and nslookup).

However, my system was still trying to use the old IP address when I tried a simple ssh or telnet command.

In the end, I discovered how to flush my local DNS cache, which fixed the problem. You can do this as follows:

$ dscacheutil -flushcache


Leave a Reply