[Bug] macOS 未同意 Xcode license 时「电脑操作」启用失败:lipo 架构校验 exit 69,且应用日志无任何记录
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
- 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category
工具调用 / MCP · Tool use / MCP
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
阻塞使用 · Blocking (无法使用核心功能 / core function unusable)
复现频率 · Reproducibility
必现 · Always
问题描述 · Description
一句话:macOS 上装了 Xcode 但未同意其许可协议时,「电脑操作」启用必然失败,且应用日志里没有任何 CUA 相关记录,用户无法自行定位。
根因链(已在 3.11.2 的 app.asar/out/host/index.js 中逐段核实):
- macOS 打包版的 Helper 安装流程:复制内置
ZCode Computer Use.app(/Applications/ZCode.app/Contents/Resources/cua-helper/)到~/.zcode/computer-use/下的 staging 目录 → 校验(verifyCuaHelperBundle)→ rename 落盘 → 清隔离 → 写.zcode-cua-helper-meta.json。 - 校验链中的
readExecutableArchs调用/usr/bin/lipo -archs <executable>。lipo是 xcode-select 的 shim,Xcode license 未同意时拒绝执行(exit 69,stderr:You have not agreed to the Xcode license agreements...),校验失败,安装中止,staging 目录被 finally 清理。 - 结果:
~/.zcode/computer-use/里只剩一个空的.zcode-cua-helper-install.lock,Helper 永远装不上,工具栏红点 + 「电脑操作启用失败」。
我逐项复跑了校验链的其余环节,全部通过,可排除其他原因:
plutil读 Info.plist:bundleIddev.zcode.cua-helper、buildIdpipeline-277386-89817f5b,与 host 内固定值一致 ✓codesign --verify --deep --strict✓,TeamIdentifier8A5X4JJ39T与固定值一致 ✓spctl -a -vv -t exec✓(Notarized)- 二进制实为 arm64(
file命令可证)✓ —— 即 license 修掉后安装即可成功
两个加重问题:
- 日志缺失:
~/.zcode/v2/logs/2026-09-15.log中没有任何 CUA/Helper 安装失败的记录,而错误提示让用户「让 ZCode 排查日志」。对比 #364(3.9.1 时期日志里有cua helper warmup failed: ...),3.11.2 的安装失败路径似乎不再落日志,疑似回归。 - 提示不可行动:错误文案是「重启 ZCode 应用后重试」,但这类环境前置条件(Xcode license)重启永远无法解决。
与 #364 同属 verifyCuaHelperBundle 的架构校验环节,但根因不同(那是 Intel 上 x86_64 vs x64 命名匹配 bug,已在 3.10.0 修复;本 issue 是 lipo 依赖 Xcode license 的问题,arm64 也会触发)。
复现步骤 · Steps to reproduce
- macOS(arm64)安装 Xcode(任意近版本,我这里是 27.0),不运行
sudo xcodebuild -license。 - 验证环境:
/usr/bin/lipo -archs /bin/ls→ 输出 "You have not agreed to the Xcode license agreements",exit 69。 - 启动 ZCode 3.11.2,点击工具栏「电脑操作」启用。
- 图标转红,提示「电脑操作启用失败 · 重启 ZCode 应用后重试」;重启无效。
ls ~/.zcode/computer-use/→ 只有空的.zcode-cua-helper-install.lock。
期望表现 · Expected behavior
- 架构检查不依赖 Xcode 工具链:直接在 Node 里解析 Mach-O header(fat header /
mach_header的 cputype),或对 lipo 失败做降级(如file)。 - 识别 license 类失败(exit 69 / stderr 特征串),给出可行动提示(如「请运行
sudo xcodebuild -license accept」)。 - Helper 安装失败的原因写入
~/.zcode/v2/logs/。
实际表现 · Actual behavior
Helper 安装在校验环节静默失败,无日志、无环境提示,功能不可用(workaround:sudo xcodebuild -license accept 后完全退出重启 ZCode,或 sudo xcode-select --switch /Library/Developer/CommandLineTools)。
ZCode 版本 · ZCode version
3.11.2
设备 / 系统 / 浏览器 · Device / OS / Browser
MacBook Pro(Apple Silicon,darwin 25.6.0 / macOS 15.6),Xcode 27.0(license 未同意),另装有 Command Line Tools
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
应用日志中 CUA 相关记录为空(grep -i cua ~/.zcode/v2/logs/2026-09-15.log 无结果)。关键命令输出:
$ /usr/bin/lipo -archs "/Applications/ZCode.app/Contents/Resources/cua-helper/ZCode Computer Use.app/Contents/MacOS/ZCode Computer Use"
You have not agreed to the Xcode license agreements. Please run 'sudo xcodebuild -license' ...
(exit 69)
$ file ".../MacOS/ZCode Computer Use"
Mach-O 64-bit executable arm64
$ ls -la ~/.zcode/computer-use/
-rw-------@ 1 user staff 0 ... .zcode-cua-helper-install.lock
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the source corresponding to app.asar/out/host/index.js, especially verifyCuaHelperBundle and readExecutableArchs. Reproduce the exit 69 behavior with /usr/bin/lipo, then trace the helper installation failure and logging path. Done means license-related failures are actionable, architecture validation no longer silently blocks installation, and the failure is recorded in ~/.zcode/v2/logs/.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100