EADDRINUSE: address already in use
Your server asked the operating system for a port, and the operating system said no: another process is already listening on it. The error is the same everywhere; each language just words it differently.
What it looks like
Node.js (the ::: means it tried to listen on every IPv6 and IPv4 address):
Error: listen EADDRINUSE: address already in use :::3000 Python, for example python3 -m http.server:
OSError: [Errno 48] Address already in use Both lines were produced on a Mac by starting a second server on a port that was already taken. Ruby and Rails raise Errno::EADDRINUSE, and other tools say “port already in use” in their own words. EADDRINUSE is the operating system’s name for it; on macOS it’s error number 48.
Find what’s holding the port
lsof -nP -iTCP:3000 -sTCP:LISTEN Swap in the port from your error. The output names the process and its PID. If it’s an old copy of the server you’re trying to start, that’s the usual cause: a terminal tab you forgot, or a process that outlived its editor. lsof for ports on macOS explains the flags.
Fix it
- Stop the old process with
kill <PID>, then start your server again. How to kill a process on a port on Mac covers the safe way, and why the popular one-liner isn’t. - Or move your server to a free port, usually with a
PORTvariable or a-poption. - If lsof shows nothing, the port may have been freed a moment ago; try again. If
lsofstill shows nothing and the error persists, the server may be binding twice to the same port itself (twolisten()calls), which shows up as this same error.
Ports 5000 and 7000 on a Mac
If the port in your error is 5000 or 7000, macOS itself is probably listening: Control Center’s AirPlay Receiver holds both. Turn it off in System Settings → General → AirDrop & Handoff, or pick another port.