What is running on a port on a Mac: find the process
You want to know what is using a port, or what is listening on your Mac right now. The Terminal answers both.
One port
lsof -nP -iTCP:3000 -sTCP:LISTEN-n skips DNS lookups, -P keeps port numbers numeric, -iTCP:3000 selects TCP on port 3000 and -sTCP:LISTEN keeps only listeners.
Everything that is listening
lsof -nP -iTCP -sTCP:LISTENThis lists every TCP listener with its command, PID, user and address. Expect system services such as rapportd. Look for node, vite, python or ruby.
Which project does a process belong to?
ps -p 41074 -o pid,ppid,etime,command
lsof -a -p 41074 -d cwdThe first line shows how long it has been running (etime) and its full command. The second shows the folder it was started from (cwd), which usually tells you the project.
Processes of other users
sudo lsof -nP -iTCP:3000 -sTCP:LISTENWithout sudo, lsof only shows your own processes.
Docker containers
docker ps --format 'table {{.Names}}\t{{.Ports}}'Containers publish ports through Docker, so this lists them by name with their ports.
All of that, in one list
Rungeist shows the dev servers running from your project folders in your menu bar, grouped by project, with the port, memory, CPU and uptime. Open one, restart it or stop it with a click.