Files
wehub-resource-sync 9a760ce2b6
Build / build (push) Has been cancelled
docs: make Chinese README the default
2026-07-13 10:19:14 +00:00

261 lines
16 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- WEHUB_ZH_README -->
> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/momenbasel/PureMac) · [上游 README](https://github.com/momenbasel/PureMac/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
<p align="center">
<img src="screenshot.png" alt="PureMac 仪表盘 — 动态存储健康环与实时构成环形图" width="820">
</p>
<p align="center">
<img src="screenshots/breakdown.png" alt="PureMac 扫描结果 — 按类别分解图表" width="820">
</p>
<p align="center">
<b>English</b> |
<a href="docs/README.ar.md">العربية</a> |
<a href="docs/README.es.md">Español</a> |
<a href="docs/README.ja.md">日本語</a> |
<a href="docs/README.zh-Hans.md">简体中文</a> |
<a href="docs/README.zh-Hant.md">繁體中文</a>
</p>
<h1 align="center">PureMac</h1>
<p align="center">
<b>夺回你的 Mac。</b><br>
免费、开源的 macOS 卸载与清理工具。无订阅、无遥测、无推销。
</p>
<p align="center">
<a href="https://github.com/momenbasel/PureMac/releases/latest"><img src="https://img.shields.io/github/v/release/momenbasel/PureMac?style=flat-square&label=Download" alt="最新版本"></a>
<img src="https://img.shields.io/badge/macOS-13.0+-blue?style=flat-square" alt="macOS 13.0+">
<img src="https://img.shields.io/badge/Signed%20%26%20Notarized-Apple-success?style=flat-square" alt="Apple 签名并公证">
<img src="https://img.shields.io/badge/telemetry-none-success?style=flat-square" alt="无遥测">
<a href="LICENSE"><img src="https://img.shields.io/github/license/momenbasel/PureMac?style=flat-square" alt="MIT License"></a>
<a href="https://github.com/momenbasel/PureMac/stargazers"><img src="https://img.shields.io/github/stars/momenbasel/PureMac?style=flat-square" alt="Stars"></a>
<a href="https://github.com/momenbasel/PureMac/releases"><img src="https://img.shields.io/github/downloads/momenbasel/PureMac/total?style=flat-square&label=Downloads" alt="Downloads"></a>
</p>
<p align="center">
<a href="#install">安装</a> -
<a href="#why-this-exists">为何存在</a> -
<a href="#how-it-compares">对比</a> -
<a href="#our-promise">我们的承诺</a> -
<a href="#what-it-does">功能</a> -
<a href="#permissions">权限</a> -
<a href="#contributing">贡献</a>
</p>
<p align="center">
<sub>想要更多开源软件?试试 <a href="https://github.com/momenbasel/pesty"><b>Pesty</b></a> — 一款免费、原生的 macOS 剪贴板管理器。</sub>
</p>
---
## 安装
```bash
brew install --cask puremac
```
或从 [Releases](https://github.com/momenbasel/PureMac/releases/latest)) 下载已签名、已公证的 `.dmg`,将 PureMac 拖入 `/Applications`。无 Gatekeeper 警告,无需隔离属性变通。
### 从源码构建
```bash
brew install xcodegen
git clone https://github.com/momenbasel/PureMac.git
cd PureMac
xcodegen generate
xcodebuild -project PureMac.xcodeproj -scheme PureMac -configuration Release \
-derivedDataPath build build
open build/Build/Products/Release/PureMac.app
```
## 对比
| | **PureMac** | CleanMyMac | Pearcleaner | Mole | OnyX |
|---|:---:|:---:|:---:|:---:|:---:|
| 价格 | **免费** | $40+/yr | 免费 | CLI 免费 / GUI 付费 | 免费 |
| 开源 | **是(MIT** | 否 | 源码可用¹ | 仅 CLI | 否 |
| 原生 Mac GUI | **是** | 是 | 是 | 以终端为主 | 是 |
| 无遥测 | **是** | 否 | 是 | 是 | 是 |
| 无订阅 | **是** | 否 | 是 | — | 是 |
| 签名 + 公证 | **是** | 是 | 是 | — | 是 |
| 应用卸载器 + 孤儿文件 | **是** | 是 | 是 | 部分 | 否 |
| 仅移至废纸篓(可恢复) | **是** | 部分 | 是 | 部分 | 否 |
| 如实说明可清除空间 | **是** | 否 | n/a | n/a | n/a |
<sub>¹ Pearcleaner 采用 Apache 2.0 **+ Commons Clause** — 源码可用但未经 OSI 批准(不得出售)。PureMac 为真正的 MIT。对比反映截至 2026 年公开记录的功能;欢迎通过 PR 更正。</sub>
## 我们的承诺
Mac 清理工具会请求 macOS 授予的最高权限 — 完全磁盘访问权限(Full Disk Access)— 然后删除你的文件。这要求一种信任,而该品类二十年来一直在消耗这种信任。以下是 PureMac 对自身恪守的契约,你可以在源码中逐行验证:
- **废纸篓,绝不 `rm`。** PureMac 移除的一切均通过 `FileManager.trashItem` 进入废纸篓。若误删,拖回来即可。不会粉碎或 unlink。
- **永不遥测。** 无分析、无崩溃上报、无「匿名使用统计」、不向我们的服务器发起网络请求。应用不知道你的存在。
- **不搞虚假紧迫感。** 不会 dramatize「检测到 47 GB 垃圾!」徽章、红色警报计数或「你的 Mac 处于风险中」。我们展示中性事实,由你决定。
- **不过度承诺。** 我们不声称能「回收可清除空间」「提升 RAM」或「加速你的 Mac」— 这些没有应用能可靠做到。见下方可清除空间说明。
- **删除前由你审阅。** 不会自动删除。每项显示真实路径并支持在 Finder 中显示(Reveal-in-Finder),高风险系统路径在代码中硬排除。
- **可审计。** MIT 许可。决定删除内容的代码位于 [`PureMac/Services`](PureMac/Services) 与 [`PureMac/Logic/Scanning`](PureMac/Logic/Scanning)。阅读它。Fork 它。发布你自己的版本。
若 PureMac 日后增加遥测、对核心功能设付费墙或进行基于恐惧的扫描,它将成为它所要取代的那种东西。请监督我们恪守此承诺。
## 为何存在
Apple 销售基础款 Mac,配备 256 GB SSD 且无法升级。Mac mini、Air、每一款入门 MacBook Pro — 硬盘焊死。下一档存储价格比中端 Windows 笔记本还贵。一旦付费,你已购买的每一 GB 都弥足珍贵。
多数 Mac 清理工具是订阅应用,将磁盘占用藏在付费墙后,默认携带遥测,并靠 FUD(恐惧、不确定、怀疑)交易(「检测到 47 GB 垃圾!」)。PureMac 相反:
- **一次安装。** 无订阅、无试用、无账户。
- **无遥测。** 从不回传数据。甚至不知道你的存在。
- **MIT 开源。** 阅读代码、Fork、审计。
- **诚实扫描。** 「垃圾」指真正的垃圾:OS 本身会清除的缓存目录、你已删除应用遗留的孤儿文件、损坏的安装收据、2023 年那个 4 GB 的 Xcode DerivedData 块。
- **真正卸载。** 拖入一个应用,查看它在你资料库中留下的每个偏好 plist、缓存文件夹、容器、启动代理与日志文件,一次性全部移除。
## 功能
### 应用卸载器
发现 `/Applications``~/Applications` 中的一切,然后使用 10 级匹配引擎(bundle ID、团队标识符、entitlements、Spotlight 元数据、容器发现、公司名启发式、部分路径匹配)查找应用在磁盘上留下的每个文件。三种敏感度档位 — Strict、Enhanced、Deep — 让你选择匹配的激进程度。Apple 系统应用自动从卸载列表排除。你也可在 Finder 中右键任意应用,选择 **Services → Uninstall with PureMac** 直接进入相关文件扫描。
### 孤儿文件查找器
遍历 `~/Library` 并列出磁盘上已不存在应用遗留的文件。匹配器对照每个已安装应用的 bundle 标识符与规范化名称比对,因此你 2022 年删除某应用后遗留的 `~/Library/Containers/com.foo.bar` 会清晰显示。
### 系统清理器
智能扫描(Smart Scan)并行运行每个类别。每个类别均为独立、审慎的扫描器:
- **系统垃圾** — 系统缓存、日志、临时文件
- **用户缓存** — 动态发现,无硬编码应用列表
- **AI 应用** — Ollama 与 LM Studio 日志、缓存,可选历史清理
- **邮件文件** — 已下载的邮件附件
- **废纸篓** — 清空所有废纸篓,包括外置卷
- **大文件与旧文件** — >100 MB 或超过 1 年(永不自动选中)
- **Xcode 垃圾** — DerivedData、Archives、模拟器缓存
- **Brew 缓存** — 尊重自定义 `HOMEBREW_CACHE`
- **Node 缓存** — npm、yarn classic、pnpm 内容寻址存储
- **Docker 缓存** — 镜像、容器、构建缓存
> **关于「可清除空间」:** PureMac 在存储分解中显示你的 APFS 可清除空间(purgeable space)以保持透明,但刻意**不**将其列为待删垃圾。可清除空间由 macOS 自身保留与回收 — 第三方应用无法可靠释放,连 Finder 的可清除数字也已知不准确。声称能「回收可清除空间」的清理工具属于过度承诺。我们宁愿诚实,也不愿显得厉害。
### 定时清理
可选。可配置间隔(从每小时到每月),并设有自动清理阈值,因此后台任务仅在有值得移除的内容时才会触发。
## 权限
PureMac 需要**完全磁盘访问(Full Disk Access**权限,才能读取 macOS 默认对所有应用隐藏的目录——邮件下载、Safari 数据、TCC 数据库、受保护的应用容器。没有该权限时,清理类别大约只能发现其可能找到内容的 70%,应用卸载后也会将 `~/Library/Containers` 中的内容全部遗留。
首次启动引导会通过动画预览,逐步引导你授予该权限,并展示你需要拨动的确切开关。如果跳过,仪表盘会显示一键式「Set up」药丸按钮。如果因权限问题导致清理失败,PureMac 会打开系统设置,在 Finder 中显示其 bundle,以便你将其拖入 FDA 列表,每秒轮询权限状态,并在你授予访问权限的瞬间自动重试失败的批次。你无需重新选择任何内容。
PureMac *不会*做的事:
- 不收集遥测数据、崩溃报告或使用分析。
- 运行不需要网络连接。
- 除废纸篓外,不会将数据移动到任何其他地方。
## 故障排除
### Launchpad / Dock 显示陈旧或发暗的 PureMac 图标
macOS 会在 LaunchServices 中积极缓存应用图标。Homebrew **重新安装或升级**后,Dock 和 Launchpad 可能仍显示旧的缓存图标。PureMac 的 cask 现在在安装时会运行 `lsregister -f` 以自动刷新,但如果陈旧图标仍然存在,请手动重置缓存:
```bash
# Clear the icon caches and rebuild the LaunchServices database
sudo rm -rfv /Library/Caches/com.apple.iconservices.store
sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; 2>/dev/null
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \
-kill -r -domain local -domain user -domain system
killall Dock; killall Finder
```
给它一分钟重新播种,然后打开一次 PureMac。如果仍然卡住,重启(或安全模式启动)会强制完整重建。
## 截图
| 引导 | 应用卸载器 |
|---|---|
| ![Onboarding](screenshots/onboarding.png) | ![App Uninstaller](screenshots/app-uninstaller.png) |
| 系统垃圾 | Xcode 垃圾 |
|---|---|
| ![System Junk](screenshots/system-junk.png) | ![Xcode Junk](screenshots/xcode-junk.png) |
| 用户缓存 |
|---|
| ![User Cache](screenshots/user-cache.png) |
## 架构
```
PureMac/
Logic/Scanning/ - Heuristic scan engine, locations database, conditions
Logic/Utilities/ - Structured logging
Models/ - Data models, typed errors
Services/ - Scan engine, cleaning engine, permission coordinator, scheduler
ViewModels/ - Centralized app state
Views/ - Native SwiftUI views
Apps/ - App uninstaller views
Components/ - Shared components (FDA demo, permission sheet, theme)
Orphans/ - Orphan finder
Settings/ - Native Form-based settings
```
关键组件:
- **AppPathFinder** - 10 级启发式匹配引擎,用于发现与应用相关的文件
- **Locations** - 120+ 个 macOS 文件系统搜索路径
- **Conditions** - 25 条按应用划分的匹配规则,用于处理边缘情况(Xcode、Chrome、VS Code 等)
- **PermissionCoordinator** - FDA 提示、轮询以及授权后重试的单一事实来源
- **FullDiskAccessManager** - TCC 探测 + 注册;广泛的探测路径(Mail、Safari、Messages、AddressBook、Calendars),以便 macOS 可靠地编目 bundle
- **CleaningEngine** - 抗符号链接删除,带允许列表;对 root 拥有的项目通过基于 NSAppleScript 的管理员提权;为 xargs 使用 NUL 分隔的路径暂存
## 安全
- 符号链接攻击防护:路径在验证前解析,在 unlink 前立即重新解析,以关闭 TOCTOU 窗口。
- 允许列表清理:不在显式安全根目录内的路径会被拒绝,即使用户级清理也不例外。
- 管理员提权由*更窄*的允许列表(应用 bundle、package receipts、launch plists)把关,比普通清理器更严格——root 拥有的项目只能在这些根目录内移除。
- 系统应用保护:无论是否选中,Apple 的 bundle 都无法卸载。
- 所有破坏性操作默认需要明确确认。禁用该确认的开关深藏在设置中。
如发现漏洞,请提交私有安全公告,而非公开 issue。
## 贡献
欢迎 Pull request。详见 [CONTRIBUTING.md](CONTRIBUTING.md)。
特别欢迎:
- 按类别划分的体积与日期筛选预设
-`AppState` 和扫描引擎提供更广泛的 XCTest 覆盖
- 除当前语言集(en、ar、es、ja、pt-BR、zh-Hans、zh-Hant)之外的翻译
- 应用图标设计
## 致谢
- **[@nguyenhuy158](https://github.com/nguyenhuy158)** - 搜索与筛选功能 ([#18](https://github.com/momenbasel/PureMac/issues/18), [#29](https://github.com/momenbasel/PureMac/pull/29))
- **[@edufalcao](https://github.com/edufalcao)** - 清理安全保护与确认对话框 ([#30](https://github.com/momenbasel/PureMac/pull/30))
- **[@zeck00](https://github.com/zeck00)** - UI 大改版 ([#31](https://github.com/momenbasel/PureMac/pull/31)), 带系统应用保护的应用卸载器 ([#32](https://github.com/momenbasel/PureMac/pull/32)), 引导体验 ([#33](https://github.com/momenbasel/PureMac/pull/33))
- **[@0x-man](https://github.com/0x-man)** - 符号链接安全漏洞报告 ([#25](https://github.com/momenbasel/PureMac/issues/25))
- **[@ansidev](https://github.com/ansidev)** - 复选框交互缺陷报告 ([#34](https://github.com/momenbasel/PureMac/issues/34))
- **[@fengcheng01](https://github.com/fengcheng01)** - 应用卸载器功能请求 ([#28](https://github.com/momenbasel/PureMac/issues/28))
- **[@scholzfuni](https://github.com/scholzfuni)** - 模块化方案 ([#23](https://github.com/momenbasel/PureMac/issues/23))
- **[@Zonharo](https://github.com/Zonharo)** - 应用内自动更新请求 ([#94](https://github.com/momenbasel/PureMac/issues/94))
## Star 历史
如果 PureMac 帮你腾出了磁盘空间,点个 star 能帮助其他人发现它。
<a href="https://star-history.com/#momenbasel/PureMac&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=momenbasel/PureMac&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=momenbasel/PureMac&type=Date" />
<img alt="PureMac star history chart" src="https://api.star-history.com/svg?repos=momenbasel/PureMac&type=Date" width="720" />
</picture>
</a>
## 更多开源项目
- **[Pesty](https://github.com/momenbasel/pesty)** - 一款免费、开源的 macOS 剪贴板管理器。彩色编码的历史记录、钉板、即时搜索、键盘快速粘贴。已签名、已公证,`brew install --cask momenbasel/pesty/pesty`
## 许可证
MIT。详见 [LICENSE](LICENSE)。随意使用、fork、以自己的名义发布——许可证唯一的要求是保留版权声明。