How to clear DNS cache on macOS Sierra

If you are having trouble getting URLs or domains to resolve, they are likely cached locally. Network administrators and web developers using macOS Sierra are finding this problem very often, especially if moving websites from one server to another.

On a mac, to reset the DNS cache, you need to use the Terminal app. You can find Terminal in /Applications/Utilities or using Spotlight (Command + Space bar).

Copy and paste the following line into Terminal and hit Enter. You will be required to enter your computer password.

sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder; say cache flushed

Now that your DNS cached is cleared, your domain should resolve to it’s new address.