How to flush DNS cache on MacOS

To flush the DNS cache on macOS, open the Terminal and enter the command

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Please, note, it may require Administrator's permissions.