See what's running on any port. Kill it if you want.
Homebrew:
brew install tomenden/tap/portcurl (system-wide):
sudo curl -sf https://raw.githubusercontent.com/tomenden/port/main/port -o /usr/local/bin/port \
&& sudo chmod +x /usr/local/bin/portcurl (no sudo):
mkdir -p ~/.local/bin
curl -sf https://raw.githubusercontent.com/tomenden/port/main/port -o ~/.local/bin/port \
&& chmod +x ~/.local/bin/portMake sure ~/.local/bin is in your PATH.
Just run port:
portThat's it. You get an interactive list of every listening port on your machine. Arrow keys to navigate, K to kill, Q to quit. The selected process expands to show its full command.
port 3000 # What's on port 3000?
port 3000 8080 5432 # Check multiple ports
port 3000 -k # Kill whatever's on 3000
port 3000 -kf # Kill without asking
port --list # Non-interactive list (great for piping)$ port --list
PORT PID USER UPTIME COMMAND
------- ------- --------- ---------- -------
3000 14523 tom 2h 34m node server.js
8080 14601 tom 45m python -m http.server 8080
5432 891 postgres 3d 12h /usr/lib/postgresql/16/bin/postgres
When you press K on a process (or use port <port> -k), it sends SIGTERM first and gives the process 3 seconds to shut down gracefully. If it's still alive after that, SIGKILL finishes the job.
Single bash script (~380 lines), zero dependencies. Detects your OS and uses the right tool:
- macOS —
lsof - Linux —
ss+/proc
- Bash 4+
- macOS or Linux
- Some ports may require
sudoto see (system processes, ports < 1024)
MIT
