# Finding and killing Node.js processes on Mac

[Canonical article](https://www.ashryan.io/writing/finding-and-killing-node-js-processes-on-mac/)

Published: 2020-07-10

How to find the process using a busy local port on macOS and kill it so your Node.js dev server can restart.

A quick note to self because I’m tired of re-looking this up every once in a blue moon. Hopefully this helps others who run into this situation.

Sometimes when I go to start a Node.js server on my Mac, Node crashes and tells me:

```shell
Port 3000 is already in use
```

Great! Except I don’t have any terminals open with a server running on that port.

In this situation, I don’t care what’s running on that port. I probably exited from a development environment in a way that didn’t let Node.js know I was done. So I want the process currently using port 3000 to just go away.

There seem to be a whoooole bunch of ways to accomplish this task, and the method seems partly dependent on your OS. I’m not going to run through a bunch of explanations or options, I’m just going to note what works for me on Mac.

1. Find the process ID (PID).

   ```shell
   lsof -i :3000
   COMMAND   PID    USER    FD  TYPE  #...
   node    36823     ash   29u  IPv6  #...
   ```

2. Kill it.

   ```shell
   kill -9 36823
   ```

And that’s it.

Now port 3000 is free and I can spin up the development server I want to work on now.

***

If you want to learn more about what’s going on with these commands and what your options are, there are a lot of resources out there of varying utility. I found [this article](https://www.thegeekdiary.com/how-to-kill-processes-in-linux-using-kill-killall-and-pkill/?ref=ashryan.io) on The Geek Diary to provide just enough detail on options for killing a process.
