MervCodes

Tech Reviews From A Programmer

Killing nodemon process in mac?

1 min read

If you've used nodemon for any length of time, you've run into this: you hit Ctrl+C to stop your dev server, but the process doesn't actually die. It just sits there hogging the port like a zombie. Then you try to restart and get slapped with the dreaded EADDRINUSE error.

I deal with this at least once a week. Here's the fastest way to fix it.

TL;DR: Nodemon is a Node.js developer tool that helps to watch for file changes and restarting the node application automatically. Sometimes nodemon processes get stuck and you need to kill them manually.

The Problem

You've stopped your nodemon process (or so you thought), but when you try to start it again:

Error: listen EADDRINUSE: address already in use :::3000

This means the previous nodemon process is still running in the background, squatting on your port.

The Quick Fix

Open your terminal and nuke it:

killall -9 node

This kills all running Node.js processes on your Mac. It's the sledgehammer approach — fast, effective, and a little destructive if you have other Node processes you actually want running.

The Targeted Fix

If you have multiple Node.js apps running and only want to kill the one hogging port 3000, find its process ID first:

lsof -i :3000

Then kill just that process:

kill -9 <PID>

Replace <PID> with the actual process ID from the lsof output. This is the surgical approach — I use it when I've got a database migration script or something else running that I don't want to accidentally terminate.

After years of this, I've honestly just aliased killall -9 node to kn in my .zshrc. Life's too short to type that out every time nodemon throws a tantrum.

Sources

  1. Node.js Documentation
  2. nodemon Documentation
  3. MDN Web Docs

Related Articles

How to Debug Node.js Memory Leaks (Step-by-Step Guide)

Learn how to detect, diagnose, and fix Node.js memory leaks using heap snapshots, Chrome DevTools, and clinic.js — with real code examples.

How to Deploy a Node.js App to AWS EC2 (Step-by-Step Guide)

Deploy Node.js apps to AWS EC2 with this production-ready guide. Learn instance setup, PM2, Nginx, SSL, and automated deployments.

How to Fix CORS Errors in Node.js and Express (Complete Guide)

Master CORS errors in Express. Learn what causes them, how to fix them, and best practices for production APIs with practical examples.