Query macOS Hostname Resolution with dscacheutil
Ask Directory Services what it resolves for a hostname, the same path the system uses — ideal for verifying a DNS flush.
Run `dscacheutil -q host -a name example.com` to see the cached ip_address, ttl and other attributes the system resolver returns.
01Command
Command
$ dscacheutil -q host -a name example.com02What it does
Unlike dig, which queries DNS servers directly, dscacheutil goes through macOS's Directory Services layer — exactly what apps use when they connect — so its output reflects what your Mac is actually resolving right now, including cached answers. The -q host selects a host query, and -a name sets the hostname to look up. A quick workflow after a DNS change: flush the cache, run dscacheutil, and confirm the ip_address lines now show the new IP.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- dscacheutil - Gather information and statistics from the Directory Services cacheEvidence: Documents `-q <category>` with categories including `host`, and `-a <attribute> <value>` (e.g. `-a name <hostname>`) to query cached directory/DNS entries.
- dscacheutil(1) man pageEvidence: Man page for dscacheutil: `-q host -a name <host>` performs a host query through the Directory Services cache, showing ip_address and other returned attributes.
Last verified: 2026-09-19 · Category: Network