HOW-TO
Fix EADDRINUSE: address already in use (Node.js on Mac)
You start your Node dev server and get this error. It means another process already listens on that port.
Error: listen EADDRINUSE: address already in use :::3000What it means
Only one program can listen on a port at a time. EADDRINUSE is the error code for address in use, and :::3000 is port 3000 on all addresses. Most often the culprit is an earlier run of your own server that you forgot about.
Fix 1: stop the old process
lsof -nP -iTCP:3000 -sTCP:LISTEN
kill $(lsof -ti tcp:3000 -sTCP:LISTEN)The first line shows what holds the port, the second stops it. Start your server again.
Fix 2: use a different port
PORT=3001 npm run dev
npx next dev -p 3001
npx vite --port 3001PORT only works if your project reads it. Next.js reads it; Vite takes its own flag.
Common causes on a Mac
- A dev server you started earlier and forgot: another Terminal tab, a background job or an editor task.
- A crashed run that left a child process behind. The parent died, the child kept the port.
- A Docker container that publishes the port. Check with
docker ps --filter publish=3000. - AirPlay Receiver. On recent macOS versions it listens on ports 5000 and 7000. If your error says 5000 or 7000, turn it off in System Settings, General, AirDrop & Handoff, AirPlay Receiver.
Check that it is free
lsof -nP -iTCP:3000 -sTCP:LISTENNo output means nothing is listening and your server can start.
When it keeps happening
Rungeist shows what is on a port before you hit the error. When two projects want the same port, it marks the conflict in red, and one click stops the one you do not want.