June 3rd, 2019

Flush and Reset DNS Cache on MacOS

During web development, I’ll occasionally run into cache issues when updating DNS records. It can be tough to tell if the DNS records have properly propagated, or if I’m just pulling from an old DNS cache that hasn’t updated yet.

If you’re on MacOS, here are two handy commands that will refresh your local DNS cache:

Terminal (MacOS 10.7 and above)
sudo killall -HUP mDNSResponder

Or if you’re on an older version of MacOS:

Terminal (MacOS 10.5 and 10.6)
sudo dscacheutil -flushcache

More info can be found here.