Platter Join the Waitlist

Port 3000 is already in use

Port 3000 is the default for a lot of dev servers, Rails, Next.js and countless Express examples among them, so it’s the port that collides most. Usually the culprit is another of your own projects, or the same one still running in a terminal you forgot.

See what has port 3000

lsof -nP -iTCP:3000 -sTCP:LISTEN

Read the COMMAND and PID columns. A node or ruby process is almost certainly an earlier dev server. If it’s something you don’t recognise, look it up before stopping it.

Free it

kill <PID>

Use the PID from the lookup. Plain kill asks the server to stop cleanly; keep kill -9 for one that won’t. The details, including why kill -9 $(lsof -ti tcp:3000) can also take out your browser, are in how to kill a process on a port on Mac.

Or with npx

npx kill-port 3000

The kill-port package on npm frees a port in one step. It’s convenient, but it doesn’t show you what it’s about to stop, so you won’t learn which project was holding the port.

Or use another port

Sometimes the thing on 3000 should stay running. Most dev servers take a port option, for example PORT=3001 npm run dev for many Node servers, next dev -p 3001, or rails server -p 3001. Some tools, Next.js among them, move to the next free port on their own and say so in the terminal. Check which address it printed before you open the old one.

What the error looks like

In Node it’s Error: listen EADDRINUSE: address already in use :::3000. What that message means, and its Python and Rails equivalents, is in EADDRINUSE: address already in use.