yash.apps
Portable · Devlog

How to see every open port on your Mac

22 Nov 2026 · Yash Rawat

Which dev servers are still running? Is Postgres up? What's on port 8080? On Linux you'd reach for ss, which macOS doesn't have. Here's how to do it on a Mac, and how to read what you get back.

A network switch on a wooden desk with yellow and red Ethernet cables plugged in and green status lights on
Your Mac’s ports work much the same way, just in software: something has to be plugged in and listening. Photo by User_Pascal on Unsplash

1List every listening port

Terminal
lsof -nP -iTCP -sTCP:LISTEN

This shows every TCP port your apps are listening on. -iTCP limits it to TCP sockets, -sTCP:LISTEN to servers waiting for connections, and -nP shows raw IPs and port numbers instead of slow name lookups.

Output
COMMAND     PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
ControlCe   921  yash    9u  IPv4  0x51e…      0t0  TCP *:5000 (LISTEN)
node      42627  yash   23u  IPv6  0x9c1…      0t0  TCP *:3000 (LISTEN)
node      43110  yash   21u  IPv6  0x2d7…      0t0  TCP [::1]:5173 (LISTEN)
postgres  1188   yash    7u  IPv4  0x8f0…      0t0  TCP 127.0.0.1:5432 (LISTEN)

2How to read it

  • COMMAND is the program, cut to 9 characters (ControlCe is Control Center, which is AirPlay on port 5000). Add +c 0 for full names.
  • PID is the process ID, which you'll need to stop it.
  • NAME is the address and port. This is the part worth reading closely:
  • *:3000 means all interfaces. Other devices on your Wi-Fi can reach it at your Mac's IP. Handy for testing on a phone, risky on café Wi-Fi.
  • 127.0.0.1:5432 or [::1]:5173 means this Mac only. Nothing else on the network can connect.

3Include system processes

Without admin rights, lsof only shows processes you own. To include ones run by root or other users:

Terminal
sudo lsof -nP -iTCP -sTCP:LISTEN

UDP has no “listening” state, so list UDP sockets separately:

Terminal
lsof -nP -iUDP

4The netstat way

netstat also works. The -v flag adds the owning PID to each line (and on recent macOS versions, the process name too):

Terminal
netstat -anv -p tcp | grep LISTEN

The columns are wider and harder to scan than lsof's, so I only use it when I want TCP state details.

5Check one port, and what’s behind it

Terminal
lsof -nP -iTCP:5432 -sTCP:LISTEN

# or just "is anything answering?"
nc -z localhost 5432 && echo "open" || echo "closed"

lsof gives you a PID but not much context. When the command is just node, these two tell you what it's actually running and which project folder it started in:

Terminal
ps -p 42627 -o command=
lsof -a -p 42627 -d cwd -Fn | sed -n 's/^n//p'

Want to stop it? See how to find and kill the process on a port.

6All of this in your menu bar

I was running some version of these commands several times a day, so I put them in an app. Portable runs the same lsof and ps lookups every few seconds and shows the result in your menu bar. Every port, the app behind it (named properly: Next.js, Vite, PostgreSQL rather than node), its project folder, and a Wi-Fi mark on anything reachable from the network. Click ✕ to stop any of them.

The short version

lsof -nP -iTCP -sTCP:LISTEN lists every listening port and its process. Add sudo to see system processes. *:port is open to your network, 127.0.0.1:port is local only.

Get Portable for Mac →