Introduction

Have you ever run into the frustrating issue where a port is already in use, blocking you from starting your app? Manually finding and killing processes is time-consuming. That’s why I built kill-my-port, a simple CLI tool that helps you instantly free up any port with just one command!

Why kill-my-port?

When working with Node.js, React, Next.js, Express, Django, or any server-based app, you might encounter errors like:

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

Instead of manually searching for processes and killing them, kill-my-port does the job for you instantly.

🚀 Key Features:

Find & Kill processes by port automatically

✅ Works on Windows, macOS, and Linux

Lists all active ports if no port is provided

Fast, simple, and efficient

Installation & Usage

🔥 Quick Start (No Installation Required)

If you don’t want to install anything, just run:

npx kill-my-port 3000

This will instantly find and kill any process using port 3000.

🛠️ Global Installation

For frequent use, install it globally:

npm install -g kill-my-port

Now, you can use it anytime:

kill-my-port 3000

🔍 List Active Ports

If you don’t know which port is causing the issue, simply run:

kill-my-port

It will display all active ports, allowing you to choose which one to kill.

How It Works

Under the hood, kill-my-port runs platform-specific commands:

  • Windows: Uses netstat & taskkill to find and terminate processes.
  • macOS/Linux: Uses lsof & kill -9 to achieve the same.

Example Usage

Let’s say your React app won’t start because port 5173 is already in use. Just run:

kill-my-port 5173

You’ll see:

❗ Kill process running on port 5173? (y/n): y
✅ Port 5173 has been freed.

Now, restart your app without issues! 🎉

Where to Get It

🔗 GitHub: https://github.com/TenEplaysOfficial/kill-my-port

📦 npm: https://www.npmjs.com/package/kill-my-port

Give it a try and let me know what you think! 🚀