Query DNS Records with dig on macOS

Look up A, MX or TXT records for any domain and test against a specific DNS server like 8.8.8.8.

macOSmacosnetworkDNScliLow risk
Run `dig +short example.com A` for a terse A-record answer, or `dig @8.8.8.8 example.com MX +short` to query a specific resolver for mail records.

01Command

Command
$ dig +short example.com A && dig @8.8.8.8 example.com MX +short

02What it does

dig asks a DNS server directly, bypassing macOS's own cache, which makes it the tool of choice for verifying that new DNS records have propagated: prefixing @8.8.8.8 or @1.1.1.1 queries a specific public resolver, and comparing several resolvers shows whether propagation is complete. +short prints only the answer values (handy in scripts), while the full output without it includes TTLs and the server that answered. Replace A with MX, TXT, CNAME or AAAA for other record types.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • dig(1) man page
    Xcode Man Pages (keith.github.io) · technical · 2026-09-17
    Evidence: Man page for dig: query syntax `dig @server name type`, the +short print option for terse answers, and any record type (A, MX, TXT, …).
  • dig - DNS lookup utility
    SS64 · technical · 2026-09-17
    Evidence: Documents `dig [@server] [name] [type]` where '+short option is enabled. If short form answers' are returned, and record types such as MX; @server queries a specific resolver.

Last verified: 2026-09-19 · Category: Network