Theme
FeaturesHow It WorksPricingBlogSign In to Dashboard →Download Mac App
← All posts
Ports & Processes

How to Kill a Process on a Port on Mac (localhost:3000, 5432, 8080)

The Silo Team · 5 min read · Updated September 27, 2026

The Problem: Something Is Already on That Port

You run npm run dev and get:

Error: listen EADDRINUSE: address already in use :::3000

This happens when a previous dev server didn't exit cleanly. The process is still running, holding the socket open.

The Basic Fix: lsof + kill

# Find what's on port 3000
lsof -i :3000

# Kill it (replace PID with the number from lsof output)
kill -9 PID

This works, but it has a critical flaw: it kills just that process. If your dev server is zsh → npm run dev → next-server, killing only next-server leaves the parent npm process running. It may respawn the server or remain as a zombie consuming memory.

The Correct Fix: Process Group Termination

# Get the PID of the port listener
PID=$(lsof -ti :3000)

# Get the PGID (process group ID)
PGID=$(ps -o pgid= -p $PID | tr -d ' ')

# Kill the entire process group gracefully
kill -TERM -$PGID

# If still alive after 3 seconds:
sleep 3 && kill -KILL -$PGID 2>/dev/null

This terminates the entire parent → child process hierarchy, ensuring no zombie workers remain.

Common Dev Port Reference

PortCommon Service
3000Next.js, React dev server, Rails
4000Gatsby, Nuxt.js
5432PostgreSQL
6379Redis
8080Java apps, various APIs
8888Jupyter Notebook
9000PHP-FPM, SonarQube
27017MongoDB

Using MacPilot's Port Manager

MacPilot's Port & Socket Manager shows you every listening socket alongside its full process ancestry tree (zsh → npm → next-server) and working directory. One click sends a graceful SIGTERM to the entire process group. If the process is stubborn, escalate to SIGKILL with a second click.

It also flags sockets bound to 0.0.0.0 (publicly exposed) vs 127.0.0.1 (localhost-only) — a quick security audit with no extra tools.

See it on your own Mac.

Download Silo and find out where your space is going.

Download Silo →

Keep reading

Silo Support Desk

Help & Feedback

Send a message to our engineering team. We typically respond within 12 hours.

Direct email support: sparoconnect@gmail.com