必须通过 apple 公证并 staple 后分发 universal dmg:包含已公证的 hermesagent.app、可执行 postinstall.sh 和 .background/background.png;挂载后双击拖拽即可自动注册 path、初始化环境并启动首次向导。
☞☞☞AI 智能聊天, 问答助手, AI 智能搜索, 多模态理解力帮你轻松跨越从0到1的创作门槛☜☜☜

你需要把 Hermes Agent 的 Universal DMG 兼容包稳定分发给 macOS 用户,确保不同芯片架构(Intel 与 Apple Silicon)都能直接双击安装、无需命令行干预、不触发 Gatekeeper 阻断,且安装后能自动注册环境变量并完成首次初始化。
确认 DMG 包签名与公证状态
打开终端,执行:xattr -l /path/to/HermesAgent-universal.dmg → 若输出含 com.apple.security.code-signature 且无 com.apple.quarantine,说明已签名且未被系统标记为下载来源;若存在 com.apple.quarantine,需先用 xattr -d com.apple.quarantine /path/to/HermesAgent-universal.dmg 清除(仅限内部测试分发,正式发布前必须走 Apple Notarization 流程)。
【Apple 公证是强制前提】 未公证的 DMG 在 macOS Sonoma 及更新系统上默认禁止运行,即使已签名也会弹出“无法验证开发者”警告。必须使用 altool --notarize-app 提交至 Apple,并等待返回 success 后执行 staple 操作:xcrun stapler staple HermesAgent-universal.dmg。
构建 Universal DMG 的核心结构
DMG 必须包含以下三类文件,缺一不可:
根目录下放 HermesAgent.app(已签名+公证+staple 的通用二进制应用);
根目录下放 postinstall.sh(带 #!/bin/zsh 头、chmod +x、内含 hermes postinstall --no-interactive 调用);
根目录下放 .background/background.png(尺寸 640×480,透明背景,用于挂载后桌面图标布局)。
使用 hdiutil create -fs HFS+ -volname "HermesAgent" -srcfolder ./dist/ HermesAgent-universal.dmg 打包,而非 drag-and-drop 手动压缩——后者会丢失可执行权限与资源分支。
自动化安装引导流程
用户双击挂载 DMG 后,需实现「点击拖拽即完成部署」:
第一步:在 .DS_Store 中预设窗口大小与图标位置,使 HermesAgent.app 和 postinstall.sh 并列居中显示;
第二步:在 HermesAgent.app/Contents/Info.plist 中添加键 LSEnvironment 字典,注入 PATH 为 /opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin,避免安装时因找不到 hermes 命令而失败;
第三步:postinstall.sh 必须检测当前 shell 类型(echo $SHELL),若为 zsh(macOS 默认),则向 ~/.zshrc 追加 export PATH="$HOME/.local/bin:$PATH" 并执行 source ~/.zshrc;若为 bash,则操作 ~/.bash_profile;
第四步:脚本末尾调用 open -a "HermesAgent.app" 自动启动应用,触发首次初始化向导(该向导已内置 Kimi API Key 输入界面与端口自检逻辑)。











