Skip to content

Instantly share code, notes, and snippets.

@julianduque
Last active May 29, 2018 13:24
Show Gist options
  • Save julianduque/9513efa11a3fb310b8f4ef56c921c389 to your computer and use it in GitHub Desktop.
Save julianduque/9513efa11a3fb310b8f4ef56c921c389 to your computer and use it in GitHub Desktop.
DNS Command Line Configuration on macOS

DNS Command Line Configuration on macOS

The following commands work on macOS High Sierra, not tested in previous versions

Get DNS Resolvers

$ scutil --dns | grep 'nameserver\[[0-9]*\]'

Change DNS Resolvers

$ networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4

Reset DNS Resolvers (Default)

$ networksetup -setdnsservers Wi-Fi empty

Flush DNS Cache (High Sierra)

$ sudo killall -HUP mDNSResponder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment