<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anmol Sethi</title>
    <description>The latest articles on DEV Community by Anmol Sethi (@anmolsethi_dev).</description>
    <link>https://dev.to/anmolsethi_dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4191890%2F72f696a4-82f3-4b00-8773-b5ff3e4e19b4.jpg</url>
      <title>DEV Community: Anmol Sethi</title>
      <link>https://dev.to/anmolsethi_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anmolsethi_dev"/>
    <language>en</language>
    <item>
      <title>How to fix "port already in use" on a Mac (and stop it happening)</title>
      <dc:creator>Anmol Sethi</dc:creator>
      <pubDate>Sun, 18 Oct 2026 10:30:00 +0000</pubDate>
      <link>https://dev.to/anmolsethi_dev/how-to-fix-port-already-in-use-on-a-mac-and-stop-it-happening-4fa8</link>
      <guid>https://dev.to/anmolsethi_dev/how-to-fix-port-already-in-use-on-a-mac-and-stop-it-happening-4fa8</guid>
      <description>&lt;p&gt;You run &lt;code&gt;npm run dev&lt;/code&gt; and get this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: listen EADDRINUSE: address already in use :::3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Something is already listening on port 3000. Usually it's a dev server you started earlier and forgot about: a terminal tab you closed without stopping it, a project from yesterday, or something a coding agent started in the background.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix it in two commands
&lt;/h2&gt;

&lt;p&gt;Find what's holding the port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsof &lt;span class="nt"&gt;-i&lt;/span&gt; :3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output lists the process name and its PID (process ID):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;COMMAND   PID   USER   FD   TYPE  DEVICE  SIZE/OFF NODE NAME
node    41234  you    23u  IPv6  0x...       0t0  TCP *:hbci (LISTEN)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then stop it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;kill &lt;/span&gt;41234
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it won't go, &lt;code&gt;kill -9 41234&lt;/code&gt; forces it. Use that as a last resort: the process gets no chance to clean up.&lt;/p&gt;

&lt;p&gt;One-liner, if you're sure whatever is on the port can go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsof &lt;span class="nt"&gt;-ti&lt;/span&gt; :3000 | xargs &lt;span class="nb"&gt;kill&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why it keeps happening
&lt;/h2&gt;

&lt;p&gt;A modern project rarely runs one server. A frontend on 5173, an API on 8000, Postgres on 5432, Redis on 6379, maybe a worker and a docs site. Multiply that by the three projects you touched this week, and nothing on macOS shows you the full picture. Activity Monitor lists processes, not ports. &lt;code&gt;lsof&lt;/code&gt; answers one port at a time, and only when you already know which one to ask about.&lt;/p&gt;

&lt;p&gt;So stale servers pile up quietly, and you only notice when one blocks the port you need.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built instead
&lt;/h2&gt;

&lt;p&gt;I got tired of the &lt;code&gt;lsof&lt;/code&gt; ritual, so I built &lt;a href="https://portlivo.com/?utm_source=devto" rel="noopener noreferrer"&gt;Portlivo&lt;/a&gt;, a Mac menu bar app that shows every local dev server and port at once:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;which project each server belongs to, and the command that started it&lt;/li&gt;
&lt;li&gt;whether it's actually answering, plus CPU and memory&lt;/li&gt;
&lt;li&gt;one click to open it in the browser, restart it, tail its logs or kill it&lt;/li&gt;
&lt;li&gt;Homebrew services like Postgres and Redis in the same list&lt;/li&gt;
&lt;li&gt;a QR code to open any server on your phone&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a port clash happens, it notifies you with a &lt;strong&gt;Kill holder &amp;amp; retry&lt;/strong&gt; button, which is the button I'd wanted for years. There's also a command palette, keyboard shortcuts and a &lt;code&gt;devports&lt;/code&gt; command-line tool if you'd rather stay in the terminal.&lt;/p&gt;

&lt;p&gt;It's a native SwiftUI app for macOS 14 or later, on Apple silicon and Intel. No account, no subscription: a 7-day free trial, then a one-time licence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;lsof -i :&amp;lt;port&amp;gt;&lt;/code&gt; shows what's on a port; &lt;code&gt;kill &amp;lt;pid&amp;gt;&lt;/code&gt; stops it.&lt;/li&gt;
&lt;li&gt;Prefer &lt;code&gt;kill&lt;/code&gt; over &lt;code&gt;kill -9&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The port clash is a symptom. The real problem is not being able to see what's running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you'd like to see everything at a glance, &lt;a href="https://portlivo.com/?utm_source=medium" rel="noopener noreferrer"&gt;Portlivo&lt;/a&gt; is free to try for 7 days.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
      <category>devtool</category>
    </item>
  </channel>
</rss>
