nslookup apple.comLook up the addresses for apple.com using your configured DNS server.
When to use it
Use nslookup to check that a name resolves, see which address it points to, or compare your DNS server's answer with a public resolver's. It's available on macOS, Windows and Linux, which makes it handy when you follow instructions written for any of them.
Steps
Look up a name
Run nslookup with a domain. The first two lines show which DNS server answered; the rest is the answer.nslookup apple.comAsk for another record type
Use -type= (or -query=) for MX, TXT, NS, AAAA and others.nslookup -type=txt google.comAsk a specific DNS server
Add a server at the end. Comparing your own resolver with 1.1.1.1 shows whether your DNS returns something different.nslookup apple.com 1.1.1.1Reverse lookup
Give an IP address to find its host name (PTR record).nslookup 8.8.8.8
Output explained
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: apple.com
Address: 17.253.144.10
- Server / Address is the DNS server that answered, and #53 the port. On home networks this is usually the router.
- Non-authoritative answer means the answer came from a resolver's cache, not directly from apple.com's own name servers. That's normal.
- Name / Address are the results. Large sites often list several addresses.
** server can't find example.invalid: NXDOMAIN means the name doesn't exist.
Options and variations
| Flag | Meaning | Example |
|---|---|---|
| -type=X | Record type: A, AAAA, MX, TXT, NS, SOA, CNAME, PTR | nslookup -type=ns apple.com |
| server (last argument) | Query this DNS server instead of the default | nslookup apple.com 8.8.8.8 |
| -debug | Show the full response, including TTLs | nslookup -debug apple.com |
| -port=N | Use a DNS server on another port | nslookup -port=5353 apple.com 127.0.0.1 |
Common errors
| Error | Cause | Fix |
|---|---|---|
| ;; connection timed out; no servers could be reached | The DNS server isn't answering | Try another server (nslookup apple.com 1.1.1.1); fix your DNS settings. |
| ** server can't find NAME: NXDOMAIN | The name doesn't exist | Check the spelling or whether the domain expired. |
| ** server can't find NAME: SERVFAIL | The resolver couldn't get an answer, often DNSSEC or authoritative server problems | Try another resolver; if all fail, the domain's DNS is broken. |
Do it in the app
LightAtom's connections view shows the domain behind each connection your apps make, so you don't have to query names one by one.
Frequently asked questions
How do I use nslookup on a Mac?
Open Terminal and run nslookup followed by a domain, for example nslookup apple.com. Add -type=mx for mail servers or a server address at the end to query a specific resolver.
What does “non-authoritative answer” mean?
The answer came from a caching resolver, not from the domain's own name servers. It's the normal case and doesn't mean the answer is wrong.
Should I use nslookup or dig?
dig shows more detail (TTLs, flags, full sections) and is preferred for troubleshooting. nslookup is simpler and also exists on Windows.
Does nslookup use the same DNS as my Mac?
nslookup asks the server in /etc/resolv.conf, which macOS fills from your network settings. Apps use macOS's resolver, which can also route some names to other servers (for example VPN domains). For an exact match with apps, use dscacheutil -q host -a name apple.com.