macos-disk-cleanup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesemacOS Disk Cleanup
macOS磁盘清理
Measure before deleting, spend the safe wins first, and treat anything holding local-only state as confirm-first — it needs the user's explicit go-ahead, because nothing re-downloads it.
删除前先进行计量,优先处理安全可清理的内容,所有仅存储本地状态的内容都属于需先确认类别——需要用户明确同意后再操作,因为这些内容无法重新下载。
Process
流程
- Measure top-level and home usage.
- Drill into the largest user-owned directories.
- Classify every candidate as a quick win or confirm-first, and present the two groups separately.
- Run the quick wins; ask before each confirm-first deletion.
- Re-measure and report the delta.
Done when every consumer above ~1G is classified, each confirm-first deletion was individually approved, and a before/after frames what the run actually freed.
df -h /- 测量根目录和用户主目录的使用情况。
- 深入查看占用空间最大的用户自有目录。
- 将所有待清理项分为快速清理项和需确认清理项,并分别展示这两类。
- 执行快速清理项;在执行每个需确认的删除操作前询问用户。
- 重新测量并报告磁盘空间变化量。
完成标志:所有占用空间超过约1GB的内容都已分类,每个需确认的删除操作都获得单独批准,且通过清理前后的命令统计实际释放的空间。
df -h /Measure
测量
bash
undefinedbash
undefined1. Top-level
1. 根目录层级
du -sh /System /Users /private /Applications /Library 2>/dev/null | sort -rh
du -sh /System /Users /private /Applications /Library 2>/dev/null | sort -rh
2. Home breakdown
2. 用户主目录细分
du -sh ~/Library ~/Code ~/Downloads 2>/dev/null | sort -rh
du -sh ~/Library ~/Code ~/Downloads 2>/dev/null | sort -rh
3. Library breakdown
3. Library目录细分
du -sh ~/Library/Application\ Support/* ~/Library/Caches/* ~/Library/Group\ Containers/* 2>/dev/null | sort -rh | head -20
Aim the drill-down with the user's profile:
| Profile | Check first | Typical gain |
|---|---|---|
| Developer | Homebrew, uv/npm/pip, DerivedData, simulators | 10–20G |
| AI/ML user | Ollama unused models, HuggingFace, LM Studio | 5–15G |
| Chrome-heavy | OptGuideOnDeviceModel, GoogleUpdater | ~5G |du -sh ~/Library/Application\ Support/* ~/Library/Caches/* ~/Library/Group\ Containers/* 2>/dev/null | sort -rh | head -20
根据用户的使用场景针对性地深入排查:
| 用户类型 | 优先检查内容 | 典型释放空间 |
|---|---|---|
| 开发者 | Homebrew、uv/npm/pip、DerivedData、模拟器 | 10–20GB |
| AI/ML用户 | Ollama未使用模型、HuggingFace、LM Studio | 5–15GB |
| 重度Chrome用户 | OptGuideOnDeviceModel、GoogleUpdater | ~5GB |Quick Wins
快速清理项
Everything here rebuilds or re-downloads on demand — run without asking.
| Command | Frees | Notes |
|---|---|---|
| 2–10G | Cached installers |
| 1–10G | uv package cache |
| 500M–2G | npm cache |
| 100–500M | pip cache |
| 200–500M | pre-commit envs |
| 500M–5G | Rebuilds on demand |
| 1–10G | Unused iOS simulators |
以下所有内容都可按需重建或重新下载——无需询问即可执行。
| 命令 | 释放空间 | 说明 |
|---|---|---|
| 2–10GB | 缓存的安装包 |
| 1–10GB | uv包缓存 |
| 500MB–2GB | npm缓存 |
| 100–500MB | pip缓存 |
| 200–500MB | pre-commit环境 |
| 500MB–5GB | 可按需重建 |
| 1–10GB | 未使用的iOS模拟器 |
Path catalog
路径目录
For the per-path verdicts — Chrome, AI model caches, dev tool caches, and the confirm-first app data — read before proposing any deletion outside the quick wins above.
references/paths.md对于各路径的清理判定——Chrome、AI模型缓存、开发工具缓存以及需确认的应用数据——在提议清理上述快速清理项之外的任何内容前,请阅读。
references/paths.mdAfter Cleanup
清理后
df -h /tmutil listlocalsnapshots /df -h /tmutil listlocalsnapshots /