How to check open ports on Mac from Terminal and GUI
Ever since Apple removed the classic "Network Utility" app from macOS, Mac users have relied on terminal utilities or third-party tools to inspect open ports and check network services. Here is how to audit ports on macOS.
Method 1: List local listening ports with lsof
The lsof (list open files) command is the most reliable way to identify which processes have opened listening network sockets on your Mac:
# Show all TCP ports currently listening:
sudo lsof -iTCP -sTCP:LISTEN -n -P
# Check if a specific port (e.g. 3000) is in use:
lsof -i :3000
# Kill a process occupying a port (using the PID from lsof):
kill -9 <PID>
The -n and -P flags prevent DNS and service name lookups, producing immediate output without hanging.
Method 2: Check remote host ports with netcat (nc)
macOS includes a BSD version of nc (netcat), useful for quick checks on remote servers:
# Test a single port with a 2-second timeout:
nc -zv -G 2 192.168.1.1 80
# Test multiple ports on a server:
nc -zv -G 1 192.168.1.50 22 80 443 8080
Limitation: nc on macOS scans sequentially and has no native subnet discovery or formatted output export.
Method 3: Desktop scanner for Mac
For developers who miss Apple's classic Network Utility Port Scan tab, Open Port Scanner offers a modern replacement:
- Download
port-scanner-macos.tar.gzand extract the universal binary. - Double-click
port-scannerto open the dark-mode GUI. - Select LAN to scan your Wi-Fi/Ethernet subnet, or enter a custom target.
- Click Scan. Open ports, connection latency, and HTTP/SSH banners appear in seconds.
# Or run from Terminal (Homebrew-friendly):
./port-scanner --lan --profile quick
./port-scanner 127.0.0.1 -p 3000,5173,8080,5432 -o dev-ports.json