Skip to content

Instantly share code, notes, and snippets.

@MSayib
Created July 2, 2024 17:13
Show Gist options
  • Save MSayib/8b1773b6265fd01173104b3d6c42222c to your computer and use it in GitHub Desktop.
Save MSayib/8b1773b6265fd01173104b3d6c42222c to your computer and use it in GitHub Desktop.
Set DNS or Remove DNS on Mac

SET DNS:

  • GoogleDNS:
sudo networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4
  • CloudflareDNS:
sudo networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1
  • Other:
sudo networksetup -setdnsservers <networkservice> <dns1> [dns2] [...]

UNSET DNS:

sudo networksetup -setdnsservers Wi-Fi empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment