Shipping a Self-Contained macOS App: How 24 Homebrew dylibs Broke My DeepSeek Harness Installer
说明与用途
作者为 DeepSeek Harness 构建了一个自包含的 macOS 安装程序,修复了因 24 个 Homebrew 动态库使用绝对路径导致的崩溃。通过复制库、将路径改为 @loader_path 并重新签名,应用程序在干净的 macOS 上成功运行,大小从 792 MB 减少到 620 MB,并添加了三个插件。
问题
An Electron‑based macOS installer for DeepSeek Harness failed on clean Macs because the bundled Node binary linked 24 Homebrew‑provided dynamic libraries via absolute paths, causing the app to terminate instantly with no logs.
结果
The app became truly self‑contained, ran on clean macOS installations, reduced size, and shipped additional plugins.
工作流
- 1. Run
otool -Lon the bundled Node to list all linked dylibs. - 2. Recursively scan each dylib for further dependencies using a custom
scan()script. - 3. Copy every discovered dylib into the app’s
runtime/lib/directory. - 4. Use
install_name_tool -changeto rewrite absolute Homebrew paths to relative@loader_pathreferences. - 5. Manually handle libraries referenced via
@rpath(e.g., ICU, brotli) by copying them and updating the path. - 6. Re‑sign the modified binaries with
codesign --force --deep --sign -. - 7. Verify no remaining Homebrew paths with
otool -Land test the installer on a clean Mac.
证据
otool -L revealed 24 dynamic libraries linked by absolute Homebrew paths.
Fixing it meant copying every dylib into the app bundle, rewriting paths to @loader_path, and re‑signing.
The installer got smaller (792 MB → 620 MB) while gaining three plugins.
- 记录日期: 2026-09-21T07:45:25.944Z