Kill Port Command Generator
Type the port that is stuck on EADDRINUSE and get the exact command to find and kill the process holding it on macOS, Linux or Windows. It runs in your browser and nothing is sent anywhere.
3 commands for port 3000 on macOS
Kill port 3000 on macOS
Port 3000 is usually a Next.js, Create React App, Rails, Nuxt or Express dev server.
Kill it
lsof -ti tcp:3000 -sTCP:LISTEN | xargs killSends SIGTERM, so the process can close connections and clean up before it exits.
See what is using it first
lsof -nP -iTCP:3000 -sTCP:LISTENThe COMMAND and PID columns tell you what you are about to kill.
Force it if it will not die
lsof -ti tcp:3000 -sTCP:LISTEN | xargs kill -9SIGKILL cannot be caught, so the process gets no chance to clean up. Use it only after the plain kill fails.
Done looking up PIDs?
ports-cli lists every listening port with the process behind it. Arrow to the one you want and press Enter to kill it. macOS and Linux, nothing to install.
npx ports-cliWhat usually runs on common ports
Before you kill a port, it helps to know what normally holds it. Databases and system services restart themselves, so for those you stop the service instead. Tap a port to load its commands.
How the kill port command works
On macOS and Linux, lsof -ti tcp:3000 -sTCP:LISTEN prints only the PID of the process listening on the port, and xargs kill passes it to kill. The -sTCP:LISTEN part matters: without it, lsof also returns every client connected to the port, often your browser, and the command would kill that too.
On Windows, Get-NetTCPConnection returns the owning PID of the listening socket and Stop-Process ends it. In Command Prompt, netstat -ano lists the PID in the last column and taskkill /F ends it.
For every flag, the ss and fuser alternatives, and why the error keeps coming back, read how to kill the process on a port.
Frequently asked questions
How do I kill port 3000?
On macOS or Linux run lsof -ti tcp:3000 -sTCP:LISTEN | xargs kill. On Windows, in PowerShell, run Stop-Process -Id (Get-NetTCPConnection -LocalPort 3000 -State Listen).OwningProcess. Pick your OS in the tool above to get the exact command.
How do I kill port 8080?
Same commands with 8080: lsof -ti tcp:8080 -sTCP:LISTEN | xargs kill on macOS or Linux. On 8080 it is worth checking what is listening first, because Tomcat, Jenkins and local proxies often run as services that restart after you kill them.
Why does the port come back after I kill it?
Something is starting the process again: a file watcher such as nodemon, a service manager (launchd, systemd, Windows services, Homebrew services), or a Docker container publishing the port. Stop the thing that launches it. For Docker, find the container with docker ps and run docker stop <name>.
Is kill -9 safe?
It almost always works, but the process gets no chance to flush writes, close connections or delete temporary files. Try a plain kill (SIGTERM) first and use kill -9 only if the process is still listening afterwards. Never use it on a database.
Why is port 5000 already in use on my Mac?
Since macOS Monterey, the AirPlay Receiver listens on ports 5000 and 7000. Killing ControlCenter does not help because it relaunches. Turn AirPlay Receiver off in System Settings, under General, AirDrop & Handoff (on Monterey, System Preferences, Sharing), or run your app on another port.
Do I need sudo to kill a port?
When the process belongs to root or another user, which is usual for ports below 1024. If lsof prints nothing but the port is still taken, put sudo on both sides of the pipe: sudo lsof -ti tcp:80 -sTCP:LISTEN | sudo xargs kill. Sudo on lsof alone finds the process, then kill fails as your user. On Windows, open the terminal as Administrator.
What does npx kill-port do?
npx kill-port 3000 is a third-party npm package that finds and kills the process on a port on any OS. On macOS and Linux it sends SIGKILL and does not show you what it killed, so it suits package.json scripts better than day-to-day use.