🦀 Built in Rust · ~1.2MB · Zero dependencies

Stop guessing
what's running on your machine.
Fix port conflicts instantly.

Kill processes on any port safely with one command. Portrm detects services, prevents data loss, auto-restarts your dev server, and manages your entire stack.

View on GitHub
~1.2MB binary 0 deps 3 OS supported Full CLI + VS Code
macOS Linux Windows VS Code
portrm — bash

You've seen this before.

A crashed dev server. A zombie process. Something unknown squatting on port 3000.

The old ritual
$ npm run dev
Error: listen EADDRINUSE :::3000
$ lsof -i :3000
# ...wall of unreadable columns...
$ kill -9 84921
# fingers crossed that wasn't important
With portrm
$ ptrm fix 3000
 
✔ Next.js (PID 84921) killed safely
✔ Port 3000 is free
Restart: npm run dev
The old ritual
$ lsof -i :5432
COMMAND PID USER FD TYPE DEVICE
postgres 291 _postgres 5u IPv4
$ kill -9 291
# wait... was that my database? 😬
# hope there was no unsaved data
With portrm
$ ptrm 5432
 
⚡ PostgreSQL (PID 291)
🛡 DATABASE - data loss risk
⏱ Running for 3d 12h
→ Kill blocked. Use --force to override.
The old ritual
$ curl localhost:8080
curl: (7) Failed to connect
$ lsof -i :8080
node 7712 ...CLOSE_WAIT
$ kill 7712 && kill -9 7712
# tried twice to kill a ghost
With portrm
$ ptrm doctor
 
🩺 Found 1 zombie process
→ node (PID 7712) CLOSE_WAIT on :8080
✔ Cleaned up. Port 8080 free.
The old ritual
$ # start frontend, backend, redis, db...
Error: port 3000 in use
Error: port 8080 in use
$ lsof -i :3000 -i :8080 -i :5432
# kill each one manually, start over
# 10 minutes later...
With portrm
$ ptrm up -y
 
✔ Preflight passed (5 services)
✔ Conflicts auto-resolved
✔ frontend, api, redis, db, worker
All services running.

Everything lsof never told you.

From a single port fix to managing your entire dev stack with profiles, CI mode, and VS Code integration.

Instant Detection

Identifies Next.js, Vite, Django, PostgreSQL, Redis, Docker and 13+ services with confidence scoring. Know exactly what's running before you kill it.

3-Tier Safety System

BLOCKS system processes, WARNS about databases with data-loss risk, APPROVES dev servers. Never accidentally kill PostgreSQL again.

Auto-Restart

ptrm fix 3000 --run 'npm run dev' clears the port and restarts your server in one command. Graceful SIGTERM first, force only if needed.

Project Config

Run ptrm init to generate a .ptrm.toml in your repo. Define every service, port, run command, env vars, and readiness checks. Your entire stack, version-controlled.

Core

Dev Stack Orchestration

ptrm up starts all services from .ptrm.toml with preflight checks. ptrm down stops everything cleanly. ptrm restart frontend targets one service.

Core

Profiles

ptrm use staging switches your entire stack to staging ports and env vars defined in .ptrm.toml. One command to switch between dev, staging, and production.

Core

Doctor Mode

Scans for zombie processes, idle servers, and port conflicts automatically. ptrm doctor -y auto-fixes everything safe to clean up.

Watch & Auto-Recover

ptrm watch 3000 monitors your server continuously. When it crashes, portrm detects the reason and auto-restarts using your config.

Interactive TUI

ptrm ui launches a full terminal UI. Browse all ports, inspect processes, kill or restart - all without memorizing commands.

Preflight Checks

ptrm preflight 3000 8080 verifies ports are free before you start anything. Reads from .ptrm.toml automatically if no ports given.

CI/CD Mode

ptrm ci runs config validation, registry check, preflight, and doctor in sequence. Exits 1 on failure. Full JSON output for pipelines.

Port Grouping

ptrm group --dev organizes ports by role: frontend, backend, database, cache, infra. See your entire stack at a glance instead of a flat list.

Log Streaming

ptrm log 3000 streams live logs from whatever process is on that port. Works with containers and local processes. No more guessing which terminal has it.

History & Analytics

ptrm history --stats shows what you've killed, restarted, and fixed. Track patterns, spot recurring conflicts, and see which ports cause the most trouble.

VS Code Extension

Full sidebar dashboard in VS Code. One-click start, stop, fix, doctor, preflight. Manage your entire dev stack without leaving the editor.

🦀

Built in Rust

~1.2MB native binary. Zero runtime dependencies. No Node.js, no Python. 40x smaller than kill-port. Instant startup, every time.

.ptrm.toml

Your dev stack, defined in one file.

Run ptrm init to scaffold it. Every service gets a port, a start command, env vars, and a readiness check. Commit it to your repo - your whole team gets the same setup.

Port ownership per service
Start commands + working dirs
Environment variables per service
Readiness checks (URL or port probe)
Profiles: dev / staging / production
Preflight port checks before start
.ptrm.toml
# Generated by `ptrm init`

[project]
name = "my-app"

[services.frontend]
port = 3000
run  = "npm run dev"
cwd  = "./frontend or ."
[services.api]
port = 8080
run  = "cargo run"
cwd  = "./backend or ."

[services.db]
port = 5432
run  = "pg_ctl start"
cwd  = "./db or ."
[profiles.staging]
frontend = { port = 3100 }
api      = { port = 8180 }
VS Code Extension

Manage ports without leaving the editor.

Full sidebar dashboard. One-click start, stop, fix, doctor, preflight. Switch between dev/staging/production profiles. Auto-installs the portrm CLI binary.

PORTRM
No project found Click to initialize
Ports (6)
3000 Next.js · PID 3877 · 69.4 MB
8080 Express.js · PID 4201 · 54.8 MB
5432 PostgreSQL · PID 1024 · 38.2 MB
6379 Redis · PID 1187 · 12.6 MB
27017 MongoDB · PID 2056 · 84.1 MB
9090 Grafana · PID 3312 · 46.3 MB
Actions
Fix Port Conflicts
Doctor
Scan Dev Ports
Group by Role
Interactive TUI
History
CI Check
Update CLI

Browse, kill, and restart - without memorizing commands.

Run ptrm ui to launch a full-screen terminal dashboard. Select any port to inspect it.

ptrm interactive
ptrm interactive
PORT PROCESS PID SERVICE MEMORY UPTIME USER
3000 node 3877 Next.js 69.4 MB 9s dev
8080 node 4201 Express.js 54.8 MB 3m 12s dev
5432 postgres 1024 PostgreSQL 38.2 MB 2d 4h dev
6379 redis-server 1187 Redis 12.6 MB 2d 4h dev
27017 mongod 2056 MongoDB 84.1 MB 1d 0h dev
9090 grafana 3312 Grafana 46.3 MB 5h 17m dev
↑↓ navigate Enter detail f fix/kill r refresh q quit
ptrm interactive
⚡ Port 3000 in use
Next.js (PID 3877)
running for 9s
memory 69.4 MB
next-server (v14.2.29) TERM_PROGRAM=vscode
user dev
cwd /home/dev/projects/my-app
detected Next.js (95% confidence)
🛡️safe to kill
Esc back f fix/kill q quit

One tool. Every scenario.

ptrm fix 3000 # Kill safely with confirmation
ptrm fix 3000 -y # Skip confirmation
ptrm fix 3000 --run "npm run dev" # Kill + restart
ptrm fix 3000 8080 -y # Fix multiple ports
ptrm kill 3000 # Direct kill
ptrm scan # All listening ports
ptrm 3000 # Inspect a single port
ptrm group --dev # Grouped by role
ptrm scan --json # JSON for scripting
ptrm status # Live service status
ptrm init # Generate .ptrm.toml
ptrm up # Start all services
ptrm up -y # Start, auto-fix conflicts
ptrm down # Stop all services
ptrm restart frontend # Restart one service
ptrm use staging # Switch profile
ptrm watch 3000 # Auto-restart on crash
ptrm doctor # Find issues
ptrm doctor -y # Auto-fix all
ptrm preflight 3000 8080 # Pre-flight check
ptrm ci # Full CI check suite
ptrm history --stats # Action analytics

Portrm vs the alternatives.

kill-port and fkill are blunt instruments. Portrm is a process classification engine.

Feature lsof + kill kill-port fkill Portrm
Service identification Name only Full + confidence score
Safety checks 3-tier system
Graceful shutdown SIGTERM → escalate
Auto-restart --run flag
Dev stack up/down ptrm up / down
Watch & auto-recover ptrm watch
Doctor / diagnostics ptrm doctor
VS Code extension Marketplace
CI/CD mode ptrm ci
Profiles (dev/staging) ptrm use staging
Interactive TUI
Project config file .ptrm.toml
Binary size Built-in ~50MB ~50MB ~1.2MB
Runtime required - Node.js Node.js None

Get started in seconds.

Native binary. No Node.js. No runtime. Just run.

Try now (no install) · via npm
npx portrm scan
npm · global
npm install -g portrm
pip · via Python
pip install portrm
Cargo · via Rust
cargo install portrm
Homebrew · macOS/Linux
brew install abhishekayu/tap/portrm
Shell script · macOS / Linux
curl -fsSL https://raw.githubusercontent.com/abhishekayu/portrm/main/install.sh | sh
macOS (Intel + Apple Silicon) Linux (x86_64 + ARM64) Windows

Frequently asked questions.

Everything developers ask about port management and portrm.

How do I fix "EADDRINUSE: address already in use" error?

Run ptrm fix 3000 (replace 3000 with your port number). portrm will detect what process is using the port, check if it's safe to kill, terminate it gracefully with SIGTERM first, and suggest the restart command. Add -y to skip confirmation or --run "npm run dev" to auto-restart your dev server immediately.

What is portrm and how is it different from kill-port or fkill?

portrm is an open-source Rust CLI for intelligent port management. Unlike kill-port or fkill which blindly kill processes, portrm identifies services (Next.js, Docker, PostgreSQL, etc.), has a 3-tier safety system that blocks killing system processes and warns about databases, performs graceful shutdown, auto-restarts, and can manage your entire dev stack via a .ptrm.toml config file. It's a ~1.2MB native binary with zero runtime dependencies.

How do I find what process is using a port on macOS, Linux, or Windows?

Run ptrm 3000 to inspect any port. It shows the process name, PID, service type, memory usage, uptime, project directory, and whether it's safe to kill. For all listening ports, use ptrm scan. This replaces the hard-to-read output of lsof -i :3000 or netstat with clean, human-readable information.

How do I install portrm?

Choose your preferred method: brew install abhishekayu/tap/portrm (Homebrew), npm install -g portrm (npm), pip install portrm (pip), cargo install portrm (Cargo), or try instantly without installing via npx portrm scan. portrm supports macOS (Intel + Apple Silicon), Linux (x86_64 + ARM64), and Windows.

How do I kill a process running on a specific port?

Use ptrm fix <port> to safely kill a process. For example, ptrm fix 3000 identifies the process, checks safety (blocks system processes, warns about databases), sends SIGTERM first, waits for clean exit, and only escalates to SIGKILL if needed. Use ptrm fix 3000 8080 -y to fix multiple ports at once without confirmation.

Can portrm manage my entire dev stack (frontend, backend, database)?

Yes. Run ptrm init to generate a .ptrm.toml config file, define your services with ports, run commands, and environment variables, then use ptrm up to start everything and ptrm down to stop. It supports profiles for switching between development, staging, and production environments, preflight checks, crash monitoring with auto-restart via ptrm watch, and CI/CD mode.

Is there a VS Code extension for portrm?

Yes. The portrm VS Code extension provides a sidebar dashboard showing all listening ports, one-click start/stop/fix/doctor actions, profile switching, and smart terminal integration. Search "portrm" in VS Code extensions or run code --install-extension abhishekayu.portrm-cli.

Common Port Problems portrm Solves

EADDRINUSE: address already in use

The most common Node.js port error. It means another process is already listening on the port your app needs. portrm finds the process, shows you what it is, and kills it safely with ptrm fix <port>. Works with Express, Next.js, Vite, NestJS, and any framework that binds to a TCP port.

Learn more →

Port 3000 already in use

Port 3000 is the default for React (Create React App), Next.js, and Express. When a dev server crashes without cleanup, the port stays occupied. Instead of memorizing lsof -ti :3000 | xargs kill -9, run ptrm fix 3000.

Learn more →

Port 5000 in use on macOS

Since macOS Monterey, Apple's AirPlay Receiver occupies port 5000. Flask, ASP.NET Core, and other frameworks that default to port 5000 cannot start. portrm detects system services like ControlCenter and tells you exactly what to do.

Learn more →

Docker port already allocated

When Docker cannot bind a container port, you get "port is already allocated." The conflict can be another container or a host process. portrm scans both Docker containers and host processes in one unified view with ptrm scan.

Learn more →

Kill process on any port

Developers waste time memorizing different commands for each OS. lsof on macOS, ss or fuser on Linux, netstat on Windows. portrm is one command that works everywhere: ptrm fix <port>.

Learn more →

List all listening ports

See every port in use on your machine with process names, PIDs, and commands. No flags to memorize. Just ptrm scan. Works identically on macOS, Linux, and Windows.

Learn more →