Skip to content

fix: reset TCC Accessibility entry after rebuild#91

Merged
joewongjc merged 1 commit intojoewongjc:mainfrom
fengshenx:fix/tcc-accessibility
Apr 1, 2026
Merged

fix: reset TCC Accessibility entry after rebuild#91
joewongjc merged 1 commit intojoewongjc:mainfrom
fengshenx:fix/tcc-accessibility

Conversation

@fengshenx
Copy link
Copy Markdown
Contributor

修复使用deploy.sh时,无法成功进行辅助功能授权。

根本原因:每次 deploy.sh 重新构建并签名 app
时(package-app.sh:246),codesign -f 会生成新的 CDHash。macOS TCC
数据库里已经有一条旧的授权记录(绑定旧 CDHash),但新 binary 的 hash
不匹配了。这时候 macOS 的行为是:

  1. 旧 TCC 记录还在,所以 AXIsProcessTrustedWithOptions(prompt: true)
    不会弹出新的授权弹窗(系统认为"已经处理过了")
  2. 但旧记录对应的 CDHash 和新 binary 不匹配,所以实际权限是无效的
  3. 结果就是:看起来已授权,但实际不工作。只有 tccutil reset
    清掉旧记录后,系统才会重新弹窗

最简单的修复:在 deploy.sh 里签名完成后自动 reset TCC。

Self-signed certs produce a new CDHash on every build, which silently
invalidates the TCC Accessibility record without triggering a re-prompt.
Reset the TCC entry so the system prompts for permission again.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joewongjc joewongjc merged commit 5afe316 into joewongjc:main Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants