LeftOpen

macOS 菜单栏端口管理与命令行工具

macOS Menu Bar Port Manager & CLI

把虚掩着的门
轻轻关上。

Gently close the doors
left ajar.

LeftOpen 在菜单栏里告诉你 localhost 上的端口、进程和可能关联的项目。

LeftOpen shows the ports, processes and likely projects still listening on localhost.

$ brew install --cask songhaifan/tap/leftopen

也可从 GitHub Releases 下载。

Or download it from GitHub Releases.

支持 Apple Silicon 和 Intel Mac · macOS 14+

Apple Silicon and Intel Macs · macOS 14+

The LeftOpen menu bar panel showing listening ports and their owners

只保留需要知道的事。

Only the details that matter.

端口属于谁

Know the owner

从进程、工作目录和项目标记推断归属,避免只看到一个模糊的 node。

It uses the process, working directory and project markers, so you see more than a generic node.

哪里可见

Know the scope

区分只在本机监听的服务,以及可能暴露到局域网的端口。

It distinguishes local-only services from ports that may be visible on your LAN.

该关什么

Close what you choose

可关闭的服务在前;系统服务和应用仍可查看,但不会被 LeftOpen 关闭。

Closable services come first. System services and apps remain visible, but LeftOpen will not close them.

关闭前,先再确认一次。

One last check before closing.

只发送 SIGTERM。LeftOpen 会重新确认 PID 与启动时间,并列出同一进程的其他端口。它不提供强制关闭,不碰系统进程,也不收集遥测。

SIGTERM only. LeftOpen verifies the PID and start time again, and shows other ports from the same process. There is no force-close action, no system-process control and no telemetry.

终端也一样简单。

The same clarity in your terminal.

App 随附同一套扫描与关闭规则的 CLI。

The app includes a CLI with the same scan and closing rules.

leftopen列出监听端口List listening ports
leftopen 3000解释一个端口Explain one port
leftopen close 3000确认后请求退出Request an exit after confirmation
$ leftopen

MY PROJECTS
PORT    OWNER          PROCESS    SCOPE
5173    visdelta       node       LOCAL
5511    visdelta       node       LOCAL

SERVICES
11434   Ollama         ollama     LOCAL
8384    Syncthing      syncthing  LAN

常见问题与场景。

Questions & use cases.

遇到端口被占用(Address already in use)怎么办?

Fix "Port already in use" (EADDRINUSE)

打开 LeftOpen 菜单栏或在终端运行 leftopen 3000,立刻看清是哪个开发服务或项目占用了端口,一键轻柔结束,无需重启电脑。

Open LeftOpen in your menu bar or run leftopen 3000 in your terminal. See which dev server or project owns the port and close it gently—no reboot or guess-killing needed.

为什么不用 lsof -i 或 kill -9?

Why not just lsof -i or kill -9?

lsof 往往只显示含糊的 node 和 PID,容易误杀其他项目;而 kill -9 强制终止无法执行清理钩子。LeftOpen 会向上追溯项目目录与图标,并在发 SIGTERM 前核验进程与关联端口。

lsof only prints raw PIDs and generic process names like node, risking collateral damage. kill -9 corrupts caches. LeftOpen resolves the project directory and icons, and validates start times before sending SIGTERM.

局域网可见(LAN)有什么安全风险?

What does LAN-visible mean?

绑定在 0.0.0.0 或无线网卡 IP 的端口,同 Wi-Fi 下的其他设备可以直接访问。LeftOpen 将其醒目标记为 LAN,防止调试接口或数据库在公共网络意外暴露。

Services listening on 0.0.0.0 or your Wi-Fi IP can be reached by other devices on your network. LeftOpen flags these as LAN so dev endpoints or databases aren't accidentally exposed.

支持哪些框架与项目推断?

Which frameworks and languages are supported?

支持 Node.js、Vite、Next.js、Python、Go、Rust、Docker、Redis、Postgres、Ollama 等,自动解析 package.json、pyproject.toml、Cargo.toml、go.mod 和 macOS 应用程序。

Supports Node.js, Vite, Next.js, Python, Go, Rust, Docker, Redis, Postgres, Ollama and more—by inspecting working directories, manifest files, and macOS app bundles.