Useful macOS network terminal commands – How to flush the DNS cache of Big Sur

In this video we take a look at a macOS Big Sur terminal command that will empty the DNS cache. If when when browsing the internet you encounter a large number of 404 errors, or web pages failing to load. The issue maybe related to a problem with your DNS (Domain Name System) and might be fixed by forcing the computer to clear/reset DNS. 

Note: DNS is like a digital Yellow Pages, but rather than matching peoples names, addresses and telephone numbers. DNS is used to convert IP addresses to domain names or domain names to IP addresses.

After visiting a website, the sites address is stored locally on your computer in something called a “Cache“. Clearing DNS will  force your computer to re-download the IP addresses and domain names, thus updating the Cache.

On a Macintosh computer, it is worth noting that rebooting the computer clears the DNS Cache. However, the Terminal command is often used by people in IT departments, who do not want to waste time waiting for a computer to reboot.

Quick reference notes:

  • Open the Terminal application. found in the Utilities folder within Applications
  • Type the following 

Note: You will not be able to run this command if the account you are working from does not have administrative rights over your computer. If this is the case then you will need to use the su command to give your terminal session administrative rights. 

su [admin username]
  • When you press enter on the keyboard you will be prompted for a password. Enter you administrators password.
  • Now enter the following command syntax exactly (use copy and paste if in doubt about syntax accuracy):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache has been flushed
  • Hit the Enter key
  • Once again you will be prompted to enter the administrators password
  • Your computer will inform you that your DNS cache has been cleared.
  • You can now close the Terminal pane.

Reference Material:

Wikipedia article – Terminal (macOS)


Leave a Reply

Thank you for your support


%d bloggers like this: