Port already in use (EADDRINUSE): find and kill the process
"Address already in use" means another process is listening on the port your server wants. Find its PID (`lsof -i :3000` on macOS and Linux, `netstat -ano | findstr :3000` on Windows), then stop it with `kill` or `taskkill`, or run your server on another port.
On this page
What “address already in use” means
EADDRINUSE is the error a server gets when it tries to listen on an address and port that another process already holds. Node.js describes it as an attempt to bind a server that “failed due to another server on the local system already occupying that address”. Only one process can listen on a given address and port, so the second server cannot start.
The wording depends on the runtime. These are the messages people search for:
| Source | Error text |
|---|---|
| Node.js | Error: listen EADDRINUSE: address already in use :::3000 |
| Python on Linux | OSError: [Errno 98] Address already in use |
| Python on macOS | OSError: [Errno 48] Address already in use |
| Python on Windows | OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions |
| Create React App | Something is already running on port 3000. |
The number in the Python message is the operating system’s error code for EADDRINUSE: 98 on Linux and 48 on macOS. On Windows, Flask’s documentation lists WinError 10013, a permission error, for the same situation. In the Node.js message, :::3000 means port 3000 on ::, the all-addresses IPv6 wildcard.
The fix has two parts: find the process that owns the port, then either stop it or move your server to another port.
Find and stop the process on macOS
lsof lists open files, and network sockets count as files. Ask it for TCP sockets in the LISTEN state on your port:
lsof -nP -iTCP:3000 -sTCP:LISTEN
-n and -P print raw addresses and port numbers instead of names, which is faster. The output shows the command and its PID:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Python 55077 you 3u IPv4 0x... 0t0 TCP 127.0.0.1:3000 (LISTEN)
Stop it by PID:
kill 55077
kill sends TERM by default, which lets the process shut down cleanly. If it ignores that, kill -9 55077 sends KILL, which cannot be caught.
To find and stop in one line, use -t, which makes lsof print only PIDs:
kill $(lsof -t -iTCP:3000 -sTCP:LISTEN)
On macOS Monterey and later, port 5000 is often taken by the AirPlay Receiver, not by one of your projects. Flask’s documentation suggests turning off “AirPlay Receiver” in System Settings or using another port. See the port 5000 page.
Find and stop the process on Linux
ss lists sockets on Linux. -l shows listening sockets, -t limits output to TCP, -n skips name lookups and -p shows the owning process:
ss -ltnp 'sport = :3000'
The last column names the process and its PID. Stop it with kill <PID>, or kill -9 <PID> if it does not exit.
lsof works the same way as on macOS if it is installed:
lsof -nP -iTCP:3000 -sTCP:LISTEN
fuser can find and stop the owner in one step. Its port/space form selects a local TCP port, and -k kills the processes it finds:
fuser -v 3000/tcp # show the process
fuser -k 3000/tcp # kill it
Note that fuser -k sends SIGKILL unless you give another signal, so the process gets no chance to clean up.
Find and stop the process on Windows (Command Prompt)
netstat -ano lists all connections and listening ports (-a) with numeric addresses (-n) and the owning process ID (-o). Filter it with findstr:
netstat -ano | findstr :3000
The PID is the last column of the LISTENING line:
TCP 127.0.0.1:3000 0.0.0.0:0 LISTENING 6847
Check what that PID is, then end it. /f forces the process to end:
tasklist /fi "PID eq 6847"
taskkill /pid 6847 /f
Find and stop the process on Windows (PowerShell)
Get-NetTCPConnection returns TCP connections as objects, with an OwningProcess property that holds the PID:
Get-NetTCPConnection -LocalPort 3000 -State Listen |
Select-Object LocalAddress, LocalPort, OwningProcess
Look up the process name before stopping it:
Get-Process -Id (Get-NetTCPConnection -LocalPort 3000 -State Listen).OwningProcess
Then stop it:
Stop-Process -Id (Get-NetTCPConnection -LocalPort 3000 -State Listen).OwningProcess
To stop a process owned by another user, start PowerShell with Run as administrator.
When the owner is a Docker container
When a container publishes the port, the lookup commands may show a Docker process rather than your app. Stop the container, not that process. Find the container by the port it publishes:
docker ps --filter publish=3000
docker stop <container-name>
docker stop sends SIGTERM to the container’s main process and SIGKILL after a grace period.
Or use a different port
Stopping the other process is not always right: it may be a second project you still need, or a system service. Starting your server on a free port is often quicker. Each tool has its own flag or setting, collected in Change the dev server port.
Some tools pick a free port on their own. Vite and Astro move to the next available port when the default is busy, and Create React App asks whether to run on another port. If you need a fixed port (for OAuth redirect URLs or a proxy config), Vite’s server.strictPort: true makes it exit instead of moving.
The opposite problem, where the browser finds nothing on the port, is covered in localhost refused to connect.
Ports mentioned in this guide
Sources
Checked against the sources below on . Defaults can change between releases; the tool's own documentation wins if it disagrees.
- Node.js errors: common system errors
- Flask docs: Development Server, address already in use
- XNU source: bsd/sys/errno.h
- Create React App source: WebpackDevServerUtils.js
- lsof(8) manual page
- ss(8) Linux manual page
- fuser(1) Linux manual page
- kill(1) Linux manual page
- Microsoft Learn: netstat
- Microsoft Learn: tasklist
- Microsoft Learn: taskkill
- Microsoft Learn: Get-NetTCPConnection
- Microsoft Learn: Get-Process
- Microsoft Learn: Stop-Process
- Docker docs: docker container ls
- Docker docs: docker container stop
- Vite server options: server.strictPort