👁36views
Mac Terminal: Check DNS Nameservers in 2 Commands

Running `scutil --dns` in Terminal displays all DNS nameservers your Mac currently uses, including search domains and resolver configurations. To copy them directly to your clipboard, pipe the output with `scutil --dns | grep nameserver | pbcopy`. Both commands work on macOS without installing additional tools.

CloudScale AI SEO - Article Summary
  • 1.
    What it is
    This article explains how to use Terminal commands on a Mac to view which DNS nameservers your computer is currently using for domain name resolution.
  • 2.
    Why it matters
    Knowing your DNS servers helps troubleshoot internet connectivity issues, verify network configurations, and understand which service is handling your domain lookups.
  • 3.
    Key takeaway
    Use Terminal commands to quickly check and copy your Mac's current DNS server settings.

To view the list of nameservers your mac is using, simply open Terminal and paste the following:

myMac ~ % scutil --dns | grep 'nameserver*'
  nameserver[0] : 100.64.0.1
  nameserver[0] : 9.9.9.9
  nameserver[1] : 1.1.1.1
  nameserver[2] : 8.8.8.8
  nameserver[0] : 9.9.9.9
  nameserver[1] : 1.1.1.1
  nameserver[2] : 8.8.8.8

Alternatively, you can copy the DNS servers to clipboard directly from the command line (using pbcopy):

networksetup -getdnsservers Wi-Fi | pbcopy