我厌倦了记住端口号。
I Got Sick of Remembering Port Numbers

原始链接: https://gregraiz.com/blog/local-vibe/

## Local.vibe:本地开发启动器 作者因为厌烦管理众多本地运行的服务以及它们不断变化的端口号,创建了**local.vibe**,一个仅适用于macOS的工具,旨在简化本地开发。它解决了“端口腐烂”问题——遗忘的端口和失效的浏览器标签页的混乱——通过提供一种单一、统一的方式来启动和访问项目。 Local.vibe使用每个项目中的`vibe.json`文件来定义如何启动应用程序。它会自动分配一个空闲端口,并将自定义的`.vibe`域名(例如`https://blog.vibe`)代理到该端口,并使用受信任的本地证书处理HTTPS。 `https://local.vibe`上的仪表盘提供了一个集中视图来管理正在运行的服务,而单个二进制文件安装则最大限度地减少了设置的复杂性。重要的是,它与编码代理集成良好——像Claude或Cursor这样的工具可以通过专用API自动配置和管理`local.vibe`。 该项目是开源的,并在GitHub上可用,寻求反馈以改进其可用性并扩展兼容性。

一个由一位开发者发起,因厌倦于记忆端口号而引发的 Hacker News 讨论,揭示了一种普遍的沮丧和几种潜在的解决方案。最初的发帖者创建了一个工具来自动分配复杂应用程序的端口。 评论者分享了类似的项目,如“outport.dev”和“sonar”,强调了对更好端口管理的需求。一个关键点是 `/etc/services` 文件的存在,该文件已经设计用于将服务名称映射到端口号,以及用于解析它们的 `getportbyname()` 函数。 对话探讨了更灵活的系统,也许类似于端口的 DNS(例如,将“vibe.local”映射到 `/etc/services`),允许服务绑定到名称而不是数字。然而,实施和维护这样一个“端口解析器”的复杂性也被承认。最终,该讨论表明,人们希望在开发和部署中,对处理端口号有更友好、更直观的方法。
相关文章

原文

I run a lot of stuff locally. Jekyll blogs, Flask APIs, Next.js apps, AI tools, little scripts that do one thing well. Each one lives on some port. Each session, I’d open a new browser tab and think: was that one on 3000? Or did I move it to 5173 because something else grabbed 3000? What about that Tailscale URL for my home server?

The real annoyance is that it wasn’t just one machine. It was layers. Local ports fighting each other. Hostnames I couldn’t remember. Scripts that would happily steal whatever port they wanted if I started them in the wrong order.

I wanted a simple launcher for all the things that aren’t traditional desktop apps. Not Finder, Alfred or Raycast. Something that understood localhost.

The problem is port rot: the slow accumulation of services, forgotten ports, and dead browser tabs that makes your local dev environment feel like a junk drawer. Worse many of these things don’t need to be running all the time. They should run when needed and then quietly spin down.

So I built local.vibe.

What it does

Tell your coding agent about local.vibe and it’ll drop a vibe.json in any project:

1
2
3
4
{
  "name": "blog",
  "cmd": "bundle exec jekyll s"
}

Run vibe start. Now https://blog.vibe works in any local browser. No more port numbers. No more “wait, which tab was that?”

It can auto-assigns a free port, passes it to your app as $PORT, and proxies the .vibe hostname to it. A local certificate gets trusted in your Keychain so HTTPS just works. The daemon watches the process; if it crashes or rebinds.

The dashboard lives at https://local.vibe and shows everything running at once.

Start, stop, edit, add an emoji icon. Switch between grid and list view.

Bookmarks work too. tailscale.vibe can redirect to your Tailscale machine. hass.vibe can proxy to your Home Assistant. Anything you’d type into a browser tab can become a .vibe name.

Why a single binary

It’s built in Go. Local.vibe is a single binary. One setup.sh, and it installs dnsmasq, a pf port-forwarding rule, and the local CA. After that, it’s just running.

The whole thing communicates over a Unix socket acting as a reverse proxy. No external services, no accounts, no telemetry.

The agent angle

One thing I didn’t expect to be useful but actually is: the setup guide endpoint.

1
curl http://localhost:7999/setup.md

Paste that into Claude Code or Cursor and the agent understands your local.vibe setup. It can register new routes, check what’s running, start and stop apps via the HTTP API. That turned out to be a genuinely useful integration to get projects onboarded quickly.

Try it

1
2
3
git clone https://github.com/graiz/local.vibe.git
cd local.vibe
./setup.sh

It’s open source, macOS only for now, MIT licensed. If you’re drowning in port numbers, give it a spin. I’d love to know what breaks, what’s missing, and whether the setup holds up on machines that aren’t mine. Drop a comment below or open an issue on GitHub.

联系我们 contact @ memedata.com