Dhiru · dev watch
"Address already in use" on Mac: how to fix EADDRINUSE
Error: listen EADDRINUSE: address already in use :::3000 (or Python's OSError: [Errno 48] Address already in use) means something is already listening on that port. Usually it's an older copy of the same dev server, left running in another terminal tab or after an editor crash.
Find it (use your port):
lsof -nP -iTCP:3000 -sTCP:LISTEN
Stop it:
kill <PID>
If lsof shows ControlCenter on 5000 or 7000, that's macOS's AirPlay Receiver. Turn it off in System Settings → General → AirDrop & Handoff, or use a different port.
Stop it happening again
Stop dev servers with Ctrl-C rather than closing the terminal window, and check what's still listening before you start a new one: lsof -nP -iTCP -sTCP:LISTEN.