Skip to content

Instantly share code, notes, and snippets.

@todd-a-jacobs
Created May 13, 2019 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todd-a-jacobs/397c632facc1022f4f2ee4693a78641a to your computer and use it in GitHub Desktop.
Save todd-a-jacobs/397c632facc1022f4f2ee4693a78641a to your computer and use it in GitHub Desktop.
Enable Cloudflare DNS (1.1.1.1) on macOS Wi-Fi interface
#!/usr/bin/env bash
# Purpose:
# Use Cloudflare's 1.1.1.1 DNS service on macOS from the command line.
# There's no Cloudflare client for the Mac to make switching easier.
# Author:
# Todd A. Jacobs
# Copyright:
# Copyright 2019 Todd A. Jacobs
# License:
# GPLv3 or later
old_dns=$(networksetup -getdnsservers Wi-Fi)
networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
new_dns=$(networksetup -getdnsservers Wi-Fi)
echo -e "New DNS\n------- \n$new_dns"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment