Query dns/domains in macos using dig and nslookup via the command line

In macos you can query a domain via the command line via default nameservers with a couple of DNS querying tools, notably nslookup and dig, how that works is on the command line:

dig domain.com


nslookup domain.com

The results are returned to you on the command line.

Query from a different nameserver

To query another different nameserver using dig or nslookup to look up dns information or check that your nameserver is acting OK – we’ll use the public Google nameservers at:

For dig use it on the command line like so:

 dig @ domain.com

For nslookup:

 nslookup domain.com

For nslookup interactively:

> server
Default server:
> bbc.com

Non-authoritative answer:
Name:	bbc.com

Or make the new nameservers default by permanently adding it to the operating system by hard coding it in the TCP/IP dns settings, for all macos versions use the Network panel in System Preferences:

Macos Dns Nameserver

Leave all Comment