一键导入
macos-app-launch-fix
Fix Sparkle framework rpath issue when launching debug macOS api2agent app
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fix Sparkle framework rpath issue when launching debug macOS api2agent app
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | macos-app-launch-fix |
| description | Fix Sparkle framework rpath issue when launching debug macOS api2agent app |
| source | auto-skill |
| extracted_at | 2026-06-02T07:06:43.787Z |
When building and running the macOS api2agent app in debug mode, the Sparkle framework may not be found at runtime due to incorrect rpath configuration. This causes the app to crash immediately with:
Library not loaded: @rpath/Sparkle.framework/Versions/B/Sparkle
When launching the debug build, you must set the DYLD_FRAMEWORK_PATH environment variable to include both the build output directory and the Sparkle framework location.
# Build with Swift Package Manager
cd macos/api2agent && swift build
# Launch with correct framework path
DYLD_FRAMEWORK_PATH=/path/to/api2agent/.build/arm64-apple-macosx/debug:\
/path/to/api2agent/.build/checkouts/sparkle/Sparkle.framework \
/path/to/api2agent/.build/arm64-apple-macosx/debug/api2agent
# Find the built app
XC_BUILD=$(find ~/Library/Developer/Xcode/DerivedData/api2agent-* \
-name "api2agent" -path "*/Build/Products/Debug/api2agent" -type f | head -1)
XC_BUILD_DIR=$(dirname "$XC_BUILD")
# Launch with framework path
DYLD_FRAMEWORK_PATH="$XC_BUILD_DIR:$XC_BUILD_DIR/PackageFrameworks" "$XC_BUILD"
Create macos/api2agent/run.sh for convenience:
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="$SCRIPT_DIR/.build/arm64-apple-macosx/debug"
if [ -f "$BUILD_DIR/api2agent" ]; then
export DYLD_FRAMEWORK_PATH="$BUILD_DIR:$SCRIPT_DIR/.build/checkouts/sparkle/Sparkle.framework"
exec "$BUILD_DIR/api2agent"
fi
# Fall back to Xcode build
DERIVED_DATA="$HOME/Library/Developer/Xcode/DerivedData"
XC_BUILD=$(find "$DERIVED_DATA" -name "api2agent" -path "*/Build/Products/Debug/api2agent" -type f 2>/dev/null | head -1)
if [ -n "$XC_BUILD" ]; then
XC_BUILD_DIR=$(dirname "$XC_BUILD")
export DYLD_FRAMEWORK_PATH="$XC_BUILD_DIR:$XC_BUILD_DIR/PackageFrameworks"
exec "$XC_BUILD"
fi
echo "Error: Could not find api2agent binary"
exit 1
App settings are stored in:
~/Library/Application Support/api2agent/settings.jsonTo force window mode (not menu-bar only), create the settings file:
mkdir -p ~/Library/Application\ Support/api2agent
echo '{"menuBarOnly":false,"port":8787}' > ~/Library/Application\ Support/api2agent/settings.json
# Check process
ps aux | grep api2agent | grep -v grep
# Test local API server
curl -s http://127.0.0.1:8787/v1/models
DYLD_FRAMEWORK_PATHmenuBarOnly setting or press Cmd+Tab to switch to the appIMKCFRunLoopWakeUpReliable errors are harmless, ignore them