How To Scan Your Local Network With Terminal On macOS (2026)
Scanning your local network from Terminal on a Mac takes two commands: arp -a for a quick list and nmap for a full sweep.
Both show the devices on your Wi-Fi or Ethernet network, with their IP addresses, and nmap can also show MAC addresses and open services.
Setup takes about five minutes, and the steps below were checked against the Nmap documentation, Homebrew and the macOS arp manual as of November 2026.
Which Terminal command should you use to scan your network on a Mac?
| Method | Install needed | Needs sudo | Best for | Command |
|---|---|---|---|---|
| arp | No, built into macOS | No | Quick list of devices your Mac has recently talked to | arp -a |
| nmap ping scan | Yes | Recommended | Finding every live device in a range | sudo nmap -sn 192.168.1.0/24 |
| nmap port scan | Yes | Recommended | Checking which ports a device exposes | nmap 192.168.1.1 |
| nmap aggressive scan | Yes | Yes | OS, service versions, scripts and traceroute for one device | sudo nmap -A 192.168.1.1 |
Only scan networks you own or have permission to scan
Scan your own home or office network, or one where the owner has said yes, because probing other people’s networks can break their rules or the law.
The commands below send real probe packets, so a managed work or school network may log them or block them.
Step 1: find your network range
Nmap needs an address range, and you can read yours from Terminal.
- Open Terminal from
/Applications/Utilities. - Run
ipconfig getifaddr en0to print your Mac’s IP address on the Wi-Fi interface. - If you are on Ethernet or the command prints nothing, run
networksetup -listallhardwareportsand use the Device name of your active connection instead ofen0. - Run
ifconfig en0to see the netmask, which macOS prints in hex.
A netmask of 0xffffff00 means /24, so an address of 192.168.1.23 gives the range 192.168.1.0/24, which covers .1 through .254.
Step 2: install nmap
You can install nmap with Homebrew or with the official installer.
- Homebrew: run
brew install nmap, and Homebrew lists prebuilt packages for Apple silicon Macs. - Official installer: download the
.dmgfrom the Nmap download page, open the.mpkginside, and enter your password when asked.
If macOS Gatekeeper blocks the installer, right-click the .mpkg, choose Open, then click Open again.
The Nmap download page lists its macOS build as x86-64, so Apple silicon owners usually find Homebrew simpler.
When it finishes, run nmap --version to confirm it is installed.
Step 3: list devices with arp
The arp command ships with macOS and reads the table of devices your Mac has already exchanged traffic with.
arp -a
Each line shows a hostname or a question mark, the IP address, the MAC address and the interface, for example ? (192.168.1.1) at aa:bb:cc:dd:ee:ff on en0 ifscope [ethernet].
arp -a -i en0limits the list to one interface.arp -anskips name lookups, which makes it faster.
Cache entries expire, so a quiet device may be missing, and that is why a real scan is more complete.
Step 4: find every live device with a ping scan
A ping scan lists which addresses answer without scanning their ports.
sudo nmap -sn 192.168.1.0/24
With sudo on a local Ethernet or Wi-Fi network, nmap sends ARP requests, which it describes as faster and more effective than other probes.
Without sudo, nmap falls back to TCP connection attempts on ports 80 and 443, so devices that ignore those ports can be missed.
Add -n to skip DNS lookups when you only want addresses.
Step 5: scan ports on one device
A plain scan of a single address checks its most common ports.
nmap 192.168.1.1
Pick the targets you care about, such as your router, a printer or a NAS, instead of scanning the whole range.
| Option | What it does |
|---|---|
-F | Fast mode, scans fewer ports than the default |
-p 22,80,443 | Scans only the ports you list |
--top-ports 100 | Scans the 100 most common ports |
-sV | Probes open ports for service and version info |
-O | Tries to detect the operating system |
-A | Turns on OS detection, version detection, script scanning and traceroute |
Step 6: save the results to a file
Nmap can write results to a file so you can compare scans later.
-oN scan.txtsaves normal readable output.-oX scan.xmlsaves XML for other programs.-oA scansaves normal, XML and grepable formats at once.
Nmap marks the grepable -oG format as deprecated, so prefer XML if you plan to process the results with a script.
What the scan results tell you
| You see | What it means | What to do |
|---|---|---|
| Host is up | The address answered the probe | Match its MAC address to a device you own |
| An unknown device | Something joined your network that you do not recognize | Check your router’s client list and change the Wi-Fi password if needed |
| Port 22 open | SSH is enabled on that device | Turn it off if you do not use it |
| Port 80 or 443 open | The device runs a web page, such as a router admin screen | Make sure it has a strong admin password |
Our guide to scanning for devices on your Wi-Fi network covers the router and app route, and disabling WPS on your router closes a common weak spot.
If the scan shows no devices or fails
- Nothing found: confirm the range matches your Mac’s address, because scanning 192.168.0.0/24 on a 192.168.1.x network finds nothing.
- Some devices missing: rerun with sudo so nmap can use ARP, and note that a device with a firewall may still stay hidden.
- Command not found: restart Terminal after installing, or run
brew install nmapagain. - Everything looks up: a router using proxy ARP can make every address appear alive, and nmap offers
--disable-arp-pingfor that case.
macOS also has a Local Network privacy setting under System Settings, Privacy & Security, Local Network, but commands run from Terminal are exempt, so it is rarely the cause.
Is there a graphical option?
Nmap’s official installer includes Zenmap, a graphical front end, though it needs the X11 application on macOS.
The arp command above needs no extra software, and nmap is the only install the other steps require.