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.
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 +short02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- dig(1) man pageEvidence: 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 utilityEvidence: 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