Skip to content
86% off$349 $48.86code BF2026

Guides

Headlamp: Could not find an available port in 4466-4565 (Mac)

Headlamp says it can't find a free port in 4466-4565 but nothing seems to use them? Prove it with sudo lsof and nc, then fix or report it.

TroubleshootingUpdated 6 min read

On this page

Headlamp shows this on launch, and you can't find anything using the ports:

text
No available ports(Could not find an available port in the range 4466-4565. Please free up a port and try again.)

The message tells you to free a port. Before you hunt for one, prove whether anything is listening. The tests below take a few minutes and tell you which case you are in.

Why Headlamp says this

Headlamp's desktop app starts a local backend and looks for a free port, starting at 4466 and trying the next one until 4565. That is 100 ports. The error means it gave up after every one failed its check. There are three possible causes, from most to least common:

  1. Something really holds the ports. A leftover backend from an earlier session, a container with a published port, or another dev tool. One process rarely holds 100 ports, so if all 100 fail, this is unlikely, but the first few ports can be taken.
  2. Your normal lsof didn't show the owner. Plain lsof only lists files you are permitted to examine, so a process owned by root or another user can be missed.
  3. The app's check is wrong. A GitHub issue for Headlamp 0.40.1 on macOS 15.5 (Homebrew install) reports the log line "Port 4466 is occupied by another process, trying next port..." for all 100 ports while lsof -i :4466-4565 returned nothing. It was closed as not planned, with no fix in the thread (last activity we saw: February 2026). We don't know the root cause.

Step-by-step: test the range

1. List listeners with sudo

bash
sudo lsof -nP -iTCP:4466-4565 -sTCP:LISTEN

This is read-only. It lists TCP sockets in the listening state on ports 4466 to 4565, with the owning process and PID.

  • Rows appear: something holds a port. Go to "If something really is listening".
  • No output: no TCP listener exists in the range. Continue.

To check UDP too:

bash
sudo lsof -nP -iUDP:4466-4565

2. Try to bind the port yourself

An independent test is to open the port. macOS ships nc (netcat):

bash
nc -l 4466

This opens a listener on port 4466 and waits. Press Control-C to stop it.

  • It waits silently: your Mac can bind that port, so it is free.
  • It prints Address already in use: something has it, even if lsof showed nothing. Repeat step 1.

Apps differ in which address they bind (localhost only or all interfaces). Also try nc -l 127.0.0.1 4466.

3. Cross-check by connecting

This asks the opposite question: does anything accept a connection on localhost in the range?

bash
for p in $(seq 4466 4565); do nc -z 127.0.0.1 $p && echo "answering: $p"; done

It tries each port and prints the ones that accept. It changes nothing.

  • No output: nothing answers on localhost in that range.
  • Ports print: something is listening. Go back to step 1 and find the owner.

Reading the results

Step 1 (sudo lsof)Step 2 (nc -l)Step 3 (connect)Meaning
RowsAddress in usePorts answerA real process holds the port. Stop it.
EmptyAddress in useEmptySomething holds it that lsof doesn't show. Re-run step 1 with sudo and check UDP.
EmptyBinds fineEmptyPorts are free. The problem is Headlamp's check.

Check your own processes with Procowl

sudo lsof settles this for the whole Mac. If you already have Procowl, it is a faster way to check your own processes, and it can confirm the "nothing is listening" case for them.

  • Ports view: open Ports (⌘4) and type 4466 in the "Who is using port…" field. If nothing of yours listens, it says "Nothing of yours is listening on 4466." The field takes one port at a time, and digits do a prefix search, so 4466 also matches 44660. Tick UDP to include UDP sockets. If a running Docker container publishes the port, the row carries a container tag.
  • Command line: procowl port 4466 does the same lookup and exits with code 1 when nothing matched. procowl ports lists every listening port of yours. Install the tool from Settings > General > Command-Line Tool > Install…. The port command needs a pass file that Procowl writes while it is licensed or in its trial.
  • What it can't see: sockets owned by root or other users are hidden ("System services (root) are hidden without admin rights."). Enhanced Access doesn't change that. Only sudo lsof covers those.

Procowl is part of MacSuite and needs macOS 14 Sonoma or later. See Ports, dev servers and Docker for the view, or the Procowl page if you want to try it free for 7 days.

If something really is listening

Note the PID and process name from step 1.

  1. If you started it and no longer need it, quit it normally first. In Procowl's Ports view, Stop… on the row asks before quitting the process.
  2. If it won't quit, follow how to kill a process on a port on Mac.
  3. Run step 1 again to confirm the range is clear, then relaunch Headlamp.

A leftover process from a previous Headlamp run is the most likely culprit. Search the lsof output for anything with "headlamp" in the command name.

If the ports are free and Headlamp still refuses

This is the case from the GitHub issue. These are low-risk things to try, not a known cure:

  1. Quit Headlamp fully (check that no Headlamp process is left running), then launch it again.
  2. Reinstall Headlamp the way you installed it (Homebrew in the reported case), or try a different version.
  3. Look in Headlamp's documentation for a way to set a different port or run it another way, such as in a browser against a cluster.
  4. Check macOS network settings. Apple's firewall controls incoming connections per app, and you can add an app and allow or block it in System Settings > Network > Firewall. Apple documents this in Change Firewall settings on Mac. We have no evidence the firewall caused the reported case, so treat this as a thing to rule out, especially if you run a third-party firewall or VPN tool.

Checklist before you report it

  • sudo lsof -nP -iTCP:4466-4565 -sTCP:LISTEN output (or the fact it was empty)
  • nc -l 4466 result
  • Result of the connect loop in step 3
  • Headlamp version, install method and macOS version
  • The exact error text from the top of this page

If nothing works

Report it to the Headlamp project through its GitHub issue tracker. The earlier issue was closed as not planned, so a new report with proof that the ports are free is more likely to get attention. If you installed through Homebrew, mention that too.

text
Headlamp <version> on macOS <version>, installed with Homebrew.
Launch fails with: No available ports(Could not find an available port in the range 4466-4565. Please free up a port and try again.)
The log says "Port 4466 is occupied by another process, trying next port..." for each port.
Checks: `sudo lsof -nP -iTCP:4466-4565 -sTCP:LISTEN` printed nothing; `nc -l 4466` bound successfully; a connect loop over 127.0.0.1:4466-4565 found nothing answering.
Reinstalling and restarting did not help. How does Headlamp decide a port is occupied?

Common questions

Why does plain lsof show nothing when a port is in use?

It only lists files you have permission to examine, so processes owned by root or other users can be missed. Run it with sudo.

Can Procowl prove no process in the range is listening?

Only for your own processes. It hides root and other users' sockets, so use sudo lsof for the full answer.

Is it safe to run these commands?

Yes. The lsof and connect-loop commands only read. nc -l opens a temporary listener until you press Control-C.

Can I just pick a different port?

Only if Headlamp offers a setting for it. We found no confirmed option, so check its documentation for your version.

Every app.
One purchase.