How to Flush DNS Cache on Mac(include M1 M2)
Recently, I've been migrating my person blog form Aliyun to Cloudflare Pages. When I modify the DNS record, I can't visit the newest blog, so I need to flush the DNS cache.
What is DNS Cache?
DNS cache is a cache of DNS records, which is used to speed up DNS lookup. When you visit a website such as www.bbc.com, the DNS record would be record on local machine. When you visit www.bbc.com again, the DNS record would be found on your own machine quickly.
How to Flush DNS Cache?
terminal or other terminal tools, open it, and input the command as follows:
1sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Note: the command would request your password.
If your MacOS version is below 10.14 (Mojave), you can use the following command to flush DNS cache:
1sudo killall -HUP mDNSResponder