From ab890dfac082575c3af25ea807ff54a03408743d Mon Sep 17 00:00:00 2001 From: canghe Date: Sat, 4 Apr 2026 14:46:12 +0800 Subject: [PATCH] Add update instructions and macOS task_for_pid troubleshooting to READMEs --- README.md | 35 +++++++++++++++++++++++++++++++++++ README_CN.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/README.md b/README.md index 3ade388..3cefdcc 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ npm install -g @canghe_ai/wechat-cli > Currently ships a **macOS arm64** binary. Other platforms can use the pip method below. PRs with additional platform binaries are welcome. +**Update to the latest version:** + +```bash +npm update -g @canghe_ai/wechat-cli +``` + ### pip ```bash @@ -103,6 +109,35 @@ If you're unsure which WeChat account is currently active, navigate to the data ![init-claude-code-4](image/init-claude-code-4.png) +#### macOS: `task_for_pid failed` Error + +On some macOS systems, `init` may fail with `task_for_pid failed` even when running with `sudo`. This is due to macOS security restrictions on process memory access. + +**WeChat CLI will automatically attempt to fix this** by re-signing WeChat with the required entitlement. Just follow the on-screen instructions: + +1. The tool will re-sign WeChat automatically +2. Quit WeChat completely (not just minimize) +3. Reopen WeChat and log in +4. Run `sudo wechat-cli init` again + +If auto re-signing fails, you can do it manually: + +```bash +# Quit WeChat first, then: +sudo codesign --force --sign - --entitlements /dev/stdin /Applications/WeChat.app <<'EOF' + + + + + com.apple.security.get-task-allow + + + +EOF +``` + +> Note: If WeChat auto-updates, you may need to re-sign it again. + ### Step 2 — Use It ```bash diff --git a/README_CN.md b/README_CN.md index d8613ec..9ff04ff 100644 --- a/README_CN.md +++ b/README_CN.md @@ -39,6 +39,12 @@ npm install -g @canghe_ai/wechat-cli > 目前提供 **macOS arm64** 二进制。其他平台可使用下方 pip 安装。欢迎提交其他平台二进制 PR。 +**更新到最新版本:** + +```bash +npm update -g @canghe_ai/wechat-cli +``` + ### pip ```bash @@ -101,7 +107,34 @@ wechat-cli init ![init-claude-code-4](image/init-claude-code-4.png) +#### macOS 遇到 `task_for_pid failed` 错误? +在某些 macOS 系统上,即使使用了 `sudo`,`init` 也可能报 `task_for_pid failed`。这是 macOS 的安全策略限制了进程内存访问。 + +**WeChat CLI 会自动尝试修复此问题**——对微信重新签名以获取必要权限。按提示操作即可: + +1. 工具会自动对微信重新签名 +2. 完全退出微信(不是最小化) +3. 重新打开微信并登录 +4. 再次执行 `sudo wechat-cli init` + +如果自动签名失败,可以手动执行: + +```bash +# 先退出微信,然后: +sudo codesign --force --sign - --entitlements /dev/stdin /Applications/WeChat.app <<'EOF' + + + + + com.apple.security.get-task-allow + + + +EOF +``` + +> 注意:如果微信自动更新了,可能需要重新执行签名。 ### 第二步 — 开始使用