Native macOS menu bar app and CLI for inspecting and closing listening localhost ports.
用于查看并关闭本机监听端口的原生 macOS 菜单栏应用与命令行工具。
Website / 官网 · Releases · Issues
LeftOpen is a native macOS Sonoma (14.0+) SwiftUI menu bar app (LeftOpenApp) and shared-engine CLI (leftopen) that maps listening ports to owning projects, processes, and optional fixed .localhost HTTPS routes via bundled Portless. For end-user overview, Homebrew installation (brew install --cask songhaifan/tap/leftopen), and feature guides, visit leftopen.songhai.site (see docs/uninstall.md for complete removal).
LeftOpen 是面向 macOS Sonoma (14.0+) 的原生 SwiftUI 菜单栏应用(LeftOpenApp)与共享引擎命令行工具(leftopen),用于识别监听端口对应的项目与进程,并可通过内置 Portless 管理固定 .localhost HTTPS 地址。终端用户介绍、Homebrew 安装(brew install --cask songhaifan/tap/leftopen)与使用说明请访问 leftopen.songhai.site(完整卸载见 docs/uninstall.md)。
Prerequisites: macOS 14.0+, Swift 6.0 (Xcode Command Line Tools), and Python 3 (for dev and packaging helper scripts).
前置环境:macOS 14.0+、Swift 6.0(Xcode Command Line Tools)与 Python 3(用于本地开发与打包辅助脚本)。
git clone https://github.com/SonghaiFan/leftopen.git
cd leftopen
# Run Swift unit tests
swift test
# Run the CLI directly via SwiftPM
swift run leftopen --json
# Build, launch, and auto-clean an isolated local test app
python3 Scripts/dev-app.py runLocal builds run as LeftOpen Test under .build/local-app.noindex with a separate bundle identifier and never install into /Applications. Quit the test app before running python3 Scripts/dev-app.py clean; CI and release builds pass LEFTOPEN_OUTPUT_DIR explicitly (see docs/releasing.md).
本地构建产物名为 LeftOpen Test,位于 .build/local-app.noindex 并使用独立 bundle ID,不会安装到 /Applications。运行 python3 Scripts/dev-app.py clean 前请先退出测试版应用;CI 与正式发布显式指定 LEFTOPEN_OUTPUT_DIR(详见 docs/releasing.md)。
- Stack: Swift 6.0, SwiftPM (
Package.swift), SwiftUI (MenuBarExtra), macOS process/socket inspection, and bundled Node.js + Portless runtime for optional fixed project addresses.
技术栈:Swift 6.0、SwiftPM(Package.swift)、SwiftUI(MenuBarExtra)、macOS 进程与端口检测,以及用于可选固定项目地址的内置 Node.js + Portless 运行时。
Sources/LeftOpenCore/ Shared port discovery, project/owner inference, safety checks, and Portless engine
Sources/LeftOpenApp/ SwiftUI menu bar app, settings panels, and app resources
Sources/LeftOpenCLI/ leftopen terminal executable (list, <port>, open, url, close, --json)
Tests/ Swift (LeftOpenCoreTests, LeftOpenAppTests), Portless JS, Homebrew Ruby, and Python tests
Scripts/ Local dev runner (dev-app.py), app build (build-app.sh), Portless prep, and release signing
Resources/ & docs/ App icon, Info.plist, Homebrew/Portless assets, landing page, and release/uninstall docs
| Command / 命令 | Description / 说明 |
|---|---|
swift test |
Run SwiftPM unit test suites (LeftOpenCoreTests and LeftOpenAppTests)运行 SwiftPM 单元测试套件( LeftOpenCoreTests 与 LeftOpenAppTests) |
swift run leftopen |
Build and execute the leftopen CLI target编译并运行 leftopen 命令行目标 |
python3 Scripts/dev-app.py run |
Build, launch, and remove the isolated local test app on exit 构建并启动隔离的本地测试版 App,退出后自动清理 |
Scripts/build-app.sh |
Build the replaceable local test .app bundle (uses LEFTOPEN_OUTPUT_DIR in CI/release)构建可替换的本地测试 .app 包(CI/发布通过 LEFTOPEN_OUTPUT_DIR 指定输出目录) |
python3 Scripts/dev-app.py clean |
Remove managed local test app output 清理脚本管理的本地测试 App 构建产物 |
python3 -m unittest discover -s Tests/ReleaseTests |
Run Python unit tests for release scripts 运行发布脚本的 Python 单元测试 |
python3 Tests/test_legacy_app_icon.py |
Verify legacy app icon packaging 校验旧版应用图标打包逻辑 |
ruby Tests/HomebrewTests/uninstall_test.rb |
Verify Homebrew uninstall safeguards 校验 Homebrew 卸载测试 |
- Fork this repository and create a branch from
main.
Fork 本仓库并从main创建开发分支。 - Run
swift test,Scripts/build-app.sh, and any relevant script/Homebrew/Portless tests locally.
在本地运行swift test、Scripts/build-app.sh以及相关的脚本 / Homebrew / Portless 测试。 - Open a pull request describing the motivation, behavior changes, and verification performed.
提交 Pull Request,说明改动背景、行为变化与本地验证情况。
MIT License. Bundled Portless (Apache-2.0) and Node.js runtimes ship with their respective licenses.
采用 MIT 许可证。随附的 Portless(Apache-2.0)与 Node.js 运行时各自保留其原始许可证。
Franklin series · Made by Songhai Fan






