Mac Cleaner
Safely analyze and reclaim disk space on macOS. Designed for everyday Mac users — no technical knowledge required.
When to use
- - "My Mac says System Data is taking too much space"
- "How do I free up disk space?"
- "Why is my disk full?"
- "Clean up my Mac storage"
- "What's taking up space on my Mac?"
What this skill covers
| Category | Safe to Clean | Notes |
|---|
| User Caches | ✅ Yes | App temporary files |
| iOS Simulators |
✅ Yes | Unused simulator devices |
| Xcode Derived Data | ✅ Yes | Build artifacts (rebuildable) |
| Browser Caches | ✅ Yes | Chrome, Safari, Firefox |
| System Logs | ✅ Old only | 7+ days old, requires sudo |
| Trash | ✅ Yes | Empty trash |
| iOS Backups | ⚠️ Review | Check if backups are needed |
| Parallels VMs | ⚠️ Review | Only if Windows not needed |
| Time Machine Snapshots | ⚠️ Review | Can delete old snapshots |
NEVER delete
- -
/System folder contents - INLINECODE1 or kernel extensions
- INLINECODE2 (system databases)
- Active iOS backups you need
- Parallels VMs you use
Quick start
Analyze (safe, read-only)
CODEBLOCK0
Shows disk usage and identifies large items without making changes.
Clean (with confirmation)
CODEBLOCK1
Performs safe cleanup after user confirmation.
What gets cleaned
- 1. User Caches (
~/Library/Caches/*)
- App temporary files, thumbnails, downloaded content
- Safe: apps rebuild these automatically
- 2. Xcode Derived Data (
~/Library/Developer/Xcode/DerivedData/*)
- Build artifacts and intermediate files
- Safe: rebuilds on next compile
- 3. iOS Simulators (unavailable devices only)
- Old iOS simulator images
- Safe: easily re-downloaded via Xcode
- 4. Browser Caches
- Chrome, Safari, Firefox cache files
- Safe: websites reload, login sessions preserved
- 5. Old System Logs (7+ days)
- Requires sudo password
- Preserves recent logs for debugging
- 6. Trash
- Empties
.Trash folder
- Safe: user already chose to delete these
Manual cleanup for large items
If the script identifies large items you want to handle manually:
iOS Device Backbacks (~/Library/Application Support/MobileSync/Backup)
CODEBLOCK2
Or use Finder → Locations → [Your iPhone] → Manage Backups
Time Machine Local Snapshots
CODEBLOCK3
Parallels VMs
Open Parallels Desktop:
- - Right-click VM → Reclaim Disk Space (safest)
- Or Delete if you don't need Windows
WeChat / Large Apps
Clear from within the app:
- - WeChat: Settings → General → Storage → Manage
- Telegram: Settings → Data and Storage → Storage Usage
- Slack: Help → Troubleshooting → Clear Cache
Large folders to review manually
| Path | What it is | Safe to delete? |
|---|
| INLINECODE6 | Downloaded files | Review first |
| INLINECODE7 |
Videos | Review first |
|
~/Parallels | Windows VMs | Only if not using |
|
~/Library/Containers/com.tencent.xinWeChat | WeChat data | Clear from WeChat app |
|
~/Library/Application Support | App data | Review per app |
Expected results
Typical cleanup results for an everyday Mac user:
- - Light user: 2-5 GB freed
- Developer: 20-50 GB freed (Xcode, simulators)
- Heavy messaging apps: 50-100 GB freed (WeChat, Telegram)
- With VMs: 50-200 GB freed (if deleting Parallels)
Troubleshooting
"Operation not permitted" errors
Grant Terminal Full Disk Access:
- 1. System Settings → Privacy & Security → Full Disk Access
- Add Terminal (or iTerm)
- Restart terminal
Cleanup didn't free much space
Run the analyze mode again:
CODEBLOCK4
Look for:
- - iOS device backups (often 50-200GB)
- Parallels VMs (20-100GB each)
- WeChat/Telegram data (can be 100GB+)
- Time Machine snapshots (can accumulate)
These require manual review before deletion.
References
- - Apple's storage documentation: https://support.apple.com/guide/mac-help/check-storage-space-mchlc03eb677/mac
- Safe macOS cleanup practices: https://support.apple.com/en-us/HT202083
技能名称: mac-cleaner
详细描述:
Mac 清理工具
安全分析并回收 macOS 磁盘空间。专为日常 Mac 用户设计——无需技术知识。
何时使用
- - 我的 Mac 显示系统数据占用太多空间
- 如何释放磁盘空间?
- 为什么我的磁盘满了?
- 清理我的 Mac 存储空间
- 什么占用了我的 Mac 空间?
本技能涵盖的内容
| 类别 | 可安全清理 | 备注 |
|---|
| 用户缓存 | ✅ 是 | 应用临时文件 |
| iOS 模拟器 |
✅ 是 | 未使用的模拟器设备 |
| Xcode 派生数据 | ✅ 是 | 构建产物(可重新构建) |
| 浏览器缓存 | ✅ 是 | Chrome、Safari、Firefox |
| 系统日志 | ✅ 仅旧日志 | 7天以上,需 sudo 权限 |
| 废纸篓 | ✅ 是 | 清空废纸篓 |
| iOS 备份 | ⚠️ 需检查 | 确认是否需要备份 |
| Parallels 虚拟机 | ⚠️ 需检查 | 仅当不需要 Windows 时 |
| 时间机器快照 | ⚠️ 需检查 | 可删除旧快照 |
切勿删除
- - /System 文件夹内容
- /Library/Extensions 或内核扩展
- /private/var/db(系统数据库)
- 你需要的活跃 iOS 备份
- 你正在使用的 Parallels 虚拟机
快速开始
分析(安全,只读)
bash
bash scripts/mac-cleanup.sh analyze
显示磁盘使用情况并识别大文件,不进行任何更改。
清理(需确认)
bash
bash scripts/mac-cleanup.sh clean
在用户确认后执行安全清理。
清理内容
- 1. 用户缓存 (~/Library/Caches/*)
- 应用临时文件、缩略图、下载内容
- 安全:应用会自动重建这些文件
- 2. Xcode 派生数据 (~/Library/Developer/Xcode/DerivedData/*)
- 构建产物和中间文件
- 安全:下次编译时会重新构建
- 3. iOS 模拟器(仅限不可用设备)
- 旧的 iOS 模拟器镜像
- 安全:可通过 Xcode 轻松重新下载
- 4. 浏览器缓存
- Chrome、Safari、Firefox 缓存文件
- 安全:网站重新加载,登录会话保留
- 5. 旧系统日志(7天以上)
- 需要 sudo 密码
- 保留近期日志用于调试
- 6. 废纸篓
- 清空 .Trash 文件夹
- 安全:用户已选择删除这些文件
大文件手动清理
如果脚本识别出你想手动处理的大文件:
iOS 设备备份 (~/Library/Application Support/MobileSync/Backup)
bash
列出备份
ls -lah ~/Library/Application\ Support/MobileSync/Backup/
删除特定备份(使用上面的文件夹名称)
rm -rf ~/Library/Application\ Support/MobileSync/Backup/[文件夹名称]
或使用 访达 → 位置 → [你的 iPhone] → 管理备份
时间机器本地快照
bash
列出快照
tmutil listlocalsnapshots /
删除所有本地快照
sudo tmutil deletelocalsnapshots /
或删除特定日期
sudo tmutil deletelocalsnapshots 2024-01-15-123456
Parallels 虚拟机
打开 Parallels Desktop:
- - 右键点击虚拟机 → 回收磁盘空间(最安全)
- 或如果不需要 Windows,则删除
微信 / 大型应用
在应用内清理:
- - 微信:设置 → 通用 → 存储空间 → 管理
- Telegram:设置 → 数据和存储 → 存储使用情况
- Slack:帮助 → 故障排除 → 清除缓存
需手动检查的大文件夹
| 路径 | 内容 | 可安全删除? |
|---|
| ~/Downloads | 下载的文件 | 先检查 |
| ~/Movies |
视频 | 先检查 |
| ~/Parallels | Windows 虚拟机 | 仅当不使用 |
| ~/Library/Containers/com.tencent.xinWeChat | 微信数据 | 从微信应用内清理 |
| ~/Library/Application Support | 应用数据 | 按应用检查 |
预期结果
日常 Mac 用户的典型清理结果:
- - 轻度用户:释放 2-5 GB
- 开发者:释放 20-50 GB(Xcode、模拟器)
- 重度消息应用用户:释放 50-100 GB(微信、Telegram)
- 有虚拟机:释放 50-200 GB(如果删除 Parallels)
故障排除
操作不允许错误
授予终端完全磁盘访问权限:
- 1. 系统设置 → 隐私与安全性 → 完全磁盘访问权限
- 添加终端(或 iTerm)
- 重启终端
清理未释放太多空间
再次运行分析模式:
bash
bash scripts/mac-cleanup.sh analyze
查找:
- - iOS 设备备份(通常 50-200GB)
- Parallels 虚拟机(每个 20-100GB)
- 微信/Telegram 数据(可能超过 100GB)
- 时间机器快照(可能累积)
这些需要手动检查后再删除。
参考
- - Apple 存储文档:https://support.apple.com/guide/mac-help/check-storage-space-mchlc03eb677/mac
- 安全的 macOS 清理实践:https://support.apple.com/en-us/HT202083