Test DNS Servers Directly with nslookup

Use nslookup's classic two-argument form to query a chosen resolver and inspect record types.

macOSDNSnslookupDiagnosticsLow risk
Run `nslookup example.com 8.8.8.8` to ask a specific DNS server, or `nslookup -type=MX <domain>` to fetch non-A records.

01Command

Command
$ nslookup example.com
nslookup example.com 8.8.8.8
nslookup -type=MX gmail.com

02What it does

nslookup's killer feature on macOS is its second argument: naming a server queries it directly instead of the system-configured resolvers, which is exactly how you verify whether a rogue DNS entry is cached locally. It separates the returned `Server:`/`Address:` pair from the answer, making resolver mismatches obvious. `dig` is the more modern tool, but nslookup's server-targeting syntax remains the quickest sanity check.

03Risk

RiskLow risk
!Warning: In non-interactive use, an invalid query can silently drop into nslookup's interactive prompt.

04Undo

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

05Sources

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

06Related solutions