· English README · llms.txt · Docs · Issues · MIT License
MacFriends 是一个面向 macOS Apple Silicon 的本地微信好友关系检测与扫描框架,英文定位是 local-first macOS WeChat friend relationship inspector CLI。它用 Rust CLI 编排受控微信副本,用 Objective-C++ agent 通过 Unix Domain Socket 暴露 profile、contacts、scan 等本地原语,并提供 JSON/CSV 导出、本地 Web 控制台、Ready 门禁和可诊断错误码。
它解决的问题不是“云端一键查僵尸粉”,而是给需要在本机、可审计、可脚本化地检查微信联系人关系的开发者和高级用户一个明确边界的工具链:固定支持版本、失败原因可见、原始数据可导出、线上可用性有门禁。
SEO / Search keywords: macOS 微信好友关系检测, 微信单删检测 macOS, 微信清理僵尸粉 macOS, WeChat friend checker CLI, WeChat ghost contact macOS, Apple Silicon WeChat tool, Rust macOS CLI, Objective-C++ agent, Unix Domain Socket IPC, ad-hoc signed WeChat copy.
- 使用 Apple Silicon Mac,并且希望在本机检测微信好友关系、联系人状态或单删线索的高级用户。
- 需要可脚本化、可导出、可排障的
macfriendsCLI,而不是只能手点 GUI 的使用者。 - 研究 macOS WeChat 本地自动化、受控副本、动态库注入、UDS IPC、Rust + Objective-C++ agent 架构的开发者。
- 想基于固定版本 adapter 扩展 WeChat 原语解析、扫描结果导出或本地控制台的人。
不适合:
- Intel Mac、Windows、Linux 用户。
- 需要支持任意最新版微信的用户。
- 期待项目代替你解释“谁删了我”的用户。MacFriends 导出原始
contacts/scan数据,关系判断需要你自行处理。 - 期待云端服务、商业背书或官方微信接口的用户。本项目不是腾讯/微信官方项目。
- Rust CLI:
doctor,status,prepare,launch,attach,profile,contacts,scan,export,detach,cleanup,serve。 - 中文命令别名:
状态,准备,启动,连接,资料,联系人,扫描,导出,断开,清理,控制台。 - 受控微信副本:
prepare会复制/Applications/WeChat.app到 MacFriends runtime 目录并 ad-hoc 签名,不修改原始微信。 - 本地 agent 与 IPC: Objective-C++ agent 通过 Unix Domain Socket 提供本地 JSON RPC。
- 本地 Web 控制台:
macfriends serve --open/macfriends 控制台 --open启动只监听127.0.0.1的中文控制台。 - 结构化输出: 支持
--json,成功和失败都返回可脚本处理的结构。 - 结果导出: 最近一次生产扫描可导出 JSON 或 CSV,CSV 会中和疑似表格公式字段。
- 运维门禁:
runtime_ready,fixture_enabled,release_blockers,primitive_resolution明确区分可用、测试和阻塞状态。 - 固定错误码:
version_mismatch,adapter_not_loaded,profile_primitive_unresolved,contacts_primitive_unresolved,scan_primitive_unresolved,rpc_timeout等。 - 可打包安装:
make install-local,make package,scripts/install.sh支持本地安装、发布包安装和上一版本备份。
| 层 | 技术 | 说明 |
|---|---|---|
| CLI | Rust 2024, clap, serde, anyhow | 命令、状态聚合、导出、Web 后端编排 |
| native agent | Objective-C++ | 注入受控微信运行态并处理本地原语请求 |
| IPC | Unix Domain Socket | 默认 socket 在 /tmp/macfriends-$USER/agent.sock |
| Web console | Rust 内置轻量 HTTP 服务 | 默认 127.0.0.1:8765,复用 CLI JSON 子命令 |
| packaging | Makefile + shell scripts | 构建 native 资产、打包 tar.gz、安装到本机 |
当前仓库是 0.1.x beta 阶段,已具备 CLI、受控副本、agent、fixture smoke、本地控制台、安装打包、日志和 Ready 门禁等工程闭环。
重要限制:
- 只支持 macOS + Apple Silicon (
arm64)。 - 当前 adapter 锁定 WeChat
4.1.8+com.tencent.xinWeChat+arm64+signature_scan。 - 生产运行态实际附着点是 WeChatAppEx
2.4.1.19024。 - 当前源码中的真实私有原语解析仍以
primitive_resolution=unresolved作为安全失败状态;看到profile_primitive_unresolved/contacts_primitive_unresolved/scan_primitive_unresolved时,不要把结果当成生产可用。 - fixture 模式仅用于测试和 CI,不代表真实微信扫描结果。
- 本项目不分发 WeChat 安装包,也不会自动跟进最新版微信。
源码开发路径:
cargo build
make -C native/agent artifacts
cargo run -p macfriends -- doctor
cargo run -p macfriends -- status
cargo run -p macfriends -- prepare
cargo run -p macfriends -- launch --login
cargo run -p macfriends -- attach
cargo run -p macfriends -- serve --open本地安装:
make install-local
macfriends doctor
macfriends status
macfriends serve --open常用中文路径:
macfriends 状态
macfriends 准备
macfriends 启动 --login
macfriends 连接
macfriends 扫描 --all
macfriends 导出 --format csv
macfriends 控制台 --open发布包:
make package输出示例:
dist/macfriends-0.1.2-macos-arm64.tar.gz
dist/macfriends-0.1.2-macos-arm64.tar.gz.sha256
安装和发布细节见 docs/install.md 与 docs/operations.md。
- 在本机检查微信联系人关系,导出 JSON/CSV 后自行做差集、状态分析或审计。
- 用
macfriends status --json做自动化巡检,确认微信版本、受控副本、agent、阻塞项和下一步动作。 - 用
macfriends 控制台 --open给中文用户提供更直观的本地操作入口。 - 基于
fixtures/adapter.wechat-macos-arm64.json开发新的 WeChat 版本 adapter。 - 研究受控 macOS App 副本、ad-hoc signing、DYLD 注入、Unix Socket agent 与 Rust CLI 的组合架构。
macfriends doctor
macfriends status
macfriends prepare [--source-app /Applications/WeChat.app] [--force]
macfriends launch --login
macfriends attach
macfriends profile
macfriends contacts
macfriends scan --all
macfriends export --format json
macfriends export --format csv
macfriends detach
macfriends cleanup
macfriends serve [--addr 127.0.0.1:8765] [--open]status 是推荐日常入口,会汇总:
- 生命周期:
not_prepared/prepared/running_blocked/ready - 本机微信版本、受控副本版本、adapter 锁定版本和兼容提示
- agent socket、PID、fixture 状态、Ready 状态和 release blockers
- 最近一次生产扫描与 fixture 扫描摘要
- 结果目录、CLI 日志、agent 日志、socket 路径
- 下一步动作建议
| 项 | 当前值 |
|---|---|
| 平台 | macOS |
| 架构 | Apple Silicon arm64 |
| WeChat bundle | com.tencent.xinWeChat |
| WeChat 版本 | 4.1.8 |
| 运行态 WeChatAppEx | 2.4.1.19024 |
| adapter | wechat_4_1_8_arm64 |
| resolver | signature_scan |
如果 prepare / doctor 报 reason=version_mismatch:
- 确认当前微信版本:
defaults read /Applications/WeChat.app/Contents/Info CFBundleShortVersionString - 确认是否能使用
WeChat 4.1.8 arm64。本仓库不提供 WeChat 安装包。 - 不愿降级时,等待或自行开发新 adapter。参考 docs/compatibility.md。
只有 doctor --json 或 attach --json 同时满足以下条件,才可视为生产 Ready:
runtime_ready = true
fixture_enabled = false
release_blockers = []
primitive_resolution.profile = resolved
primitive_resolution.contacts = resolved
primitive_resolution.scan = resolved
只要 primitive_resolution 仍是 unresolved、blocked 或 fixture,都不能把扫描结果当成真实生产结果。
发布前建议执行:
make ready
cargo run -p macfriends -- doctor --json
cargo run -p macfriends -- status --json
cargo run -p macfriends -- launch --login --json
cargo run -p macfriends -- attach --jsonmake ready 会执行格式检查、clippy、测试、构建、native agent 构建、fixture smoke 和打包。
macfriends serve --open
# 或
macfriends 控制台 --open默认监听:
http://127.0.0.1:8765
Web 控制台调用同一个 macfriends --json 后端,不维护第二套业务逻辑。常用接口包括:
GET /api/statusGET /api/compatibilityGET /api/doctorGET /api/attachGET /api/profileGET /api/contactsGET /api/logs?kind=cli|agentPOST /api/preparePOST /api/launchPOST /api/scanPOST /api/exportPOST /api/detachPOST /api/cleanup
更多说明见 docs/web-console.md。
- docs/README.md: 文档导航和读者路径。
- docs/中文用户指南.md: 中文用户从控制台到 CLI 的完整路径。
- docs/install.md: 安装、打包、发布包结构。
- docs/operations.md: 发布前检查、回滚、备份、诊断。
- docs/compatibility.md: 版本兼容矩阵与 adapter 边界。
- docs/architecture.md: Rust CLI、native agent、Web 控制台和 Ready 门禁架构。
- docs/troubleshooting.md: 常见失败、错误码和排障路径。
- llms.txt: 给 AI 搜索引擎、LLM crawler 和引用系统使用的项目摘要。
Q: 能不能用来做“微信单删检测”或“清理僵尸粉”?
可以作为本地原始数据采集工具使用,但它不替你解释关系。你需要基于导出的 contacts 和 scan 数据自行判断。
Q: 会修改我安装的微信吗?
不会。prepare 在 MacFriends runtime 目录创建受控副本并 ad-hoc 重签名,/Applications/WeChat.app 不会被修改。
Q: 为什么只支持 WeChat 4.1.8?
这是当前 adapter 的安全边界。微信版本、bundle、架构或运行态不匹配时,工具会明确失败,而不是冒险假装兼容。
Q: primitive_resolution=unresolved 是什么意思?
说明真实私有原语尚未解析闭环。此时 CLI/Web 会返回明确错误,不能视为生产扫描可用。
Q: 数据会上传吗?
不会。CLI、agent、Web 控制台都在本机运行。Web 控制台默认只监听 127.0.0.1。
Q: 支持 Intel Mac 吗?
不支持。当前只支持 Apple Silicon arm64。
如果你在 GitHub 上维护本项目,可考虑添加这些 topics 以增强搜索发现:
wechat, macos, apple-silicon, rust-cli, objective-cpp, friend-checker, unix-domain-socket, local-first, wechat-tool, cli-tool
MIT,见 LICENSE。

