Mac 清理器 CLI:免费开源的 Mac 清理工具
Mac Cleaner CLI: Free and Open Source Mac Cleanup Tool

原始链接: https://github.com/guhcostan/mac-cleaner-cli

## Mac Cleaner CLI:基于终端的清理工具 Mac Cleaner CLI 是一个免费且开源的命令行工具,用于快速清理您的 Mac。它无需安装 – 仅需在终端中运行 `npx mac-cleaner-cli`。 该工具会扫描您的系统中的垃圾文件,例如缓存、日志和临时数据,并以清晰的交互式列表显示文件大小。然后您可以选择性地选择*要*删除的内容,从而确保安全的清理过程。在提供的示例中,它释放了 41.5 GB 的空间。 **主要特点:** * **交互式且安全:** 使用复选框精确选择要删除的内容。默认情况下隐藏风险项目。 * **全面扫描:** 识别各种可清理的文件,包括浏览器数据、开发文件等。 * **维护工具:** 包括刷新 DNS 缓存和释放可清除空间等选项。 * **注重隐私:** 100% 离线运行。 * **可扩展:** 提供应用程序卸载和备份管理。 在 Windows 上可用作 `windows-cleaner-cli`。源代码在 GitHub 上公开可用,供审查和贡献。在使用任何清理工具之前,请务必备份重要数据。

这个Hacker News讨论围绕一个清理磁盘空间的工具,可能是一个最近提交的项目。一个主要的争论点是该工具依赖Node Package Manager (npm) 进行安装。 许多评论者表达了对需要安装另一个依赖项(npm/python等)的沮丧,因为该工具直接操作文件系统,他们认为应该使用像Go这样的语言构建一个独立的可执行文件。 然而,有人强烈警告不要使用该工具,因为它可能导致系统不稳定和数据丢失——具体提到了删除浏览器缓存文件夹的问题。 该评论者建议使用内置的浏览器工具。 尽管有警告,一位用户认为该工具可能对存储空间有限的旧款Mac电脑有帮助。
相关文章

原文

Free & Open Source Mac cleanup tool

Scan and remove junk files, caches, logs, and more — all from your terminal.

npm version npm downloads CI License: MIT

Node.js Version Platform: macOS TypeScript Socket Badge

GitHub Stars

Support on Ko-fi

🪟 Also available for Windows: windows-cleaner-cli


That's it! No installation needed. The CLI will:

  1. 🔍 Scan your Mac for cleanable files
  2. 📋 Show you what was found with sizes
  3. Let you select exactly what to clean
  4. 🗑️ Clean the selected items safely
$ npx mac-cleaner-cli

🧹 Mac Cleaner CLI
──────────────────────────────────────────────────────

Scanning your Mac for cleanable files...

Found 44.8 GB that can be cleaned:

? Select categories to clean (space to toggle, enter to confirm):
  ◉ 🟢 Trash                            2.1 GB (45 items)
  ◉ 🟢 Browser Cache                    1.5 GB (3 items)
  ◉ 🟢 Temporary Files                549.2 MB (622 items)
  ◉ 🟡 User Cache Files                15.5 GB (118 items)
  ◉ 🟡 Development Cache               21.9 GB (14 items)

Summary:
  Items to delete: 802
  Space to free: 41.5 GB

? Proceed with cleaning? (Y/n)

✓ Cleaning Complete!
──────────────────────────────────────────────────────
  Trash                          ✓ 2.1 GB freed
  Browser Cache                  ✓ 1.5 GB freed
  Temporary Files                ✓ 549.2 MB freed
  User Cache Files               ✓ 15.5 GB freed
  Development Cache              ✓ 21.9 GB freed

──────────────────────────────────────────────────────
🎉 Freed 41.5 GB of disk space!
   Cleaned 802 items
Feature Description
🚀 One Command Just run npx mac-cleaner-cli — no complex flags
🎯 Interactive Select exactly what you want to clean with checkboxes
🛡️ Safe by Default Risky items hidden unless you use --risky
🔍 Smart Scanning Finds caches, logs, dev files, browser data, and more
📱 App Uninstaller Remove apps completely with all associated files
🔧 Maintenance Flush DNS cache, free purgeable space
🔒 Privacy First 100% offline — no data ever leaves your machine
📦 Minimal Dependencies Only 5 runtime deps, all from trusted maintainers

🟢 Safe (always safe to delete)

Category What it cleans
trash Files in the Trash bin
temp-files Temporary files in /tmp and /var/folders
browser-cache Chrome, Safari, Firefox, Arc cache
homebrew Homebrew download cache
docker Unused Docker images, containers, volumes

🟡 Moderate (generally safe)

Category What it cleans
system-cache Application caches in ~/Library/Caches
system-logs System and application logs
dev-cache npm, yarn, pip, Xcode DerivedData, CocoaPods
node-modules Orphaned node_modules in old projects

🔴 Risky (use --risky flag)

Category What it cleans
downloads Downloads older than 30 days
ios-backups iPhone and iPad backup files
mail-attachments Downloaded email attachments
duplicates Duplicate files (keeps newest)
large-files Files larger than 500MB
language-files Unused language localizations
# Interactive mode — scan, select, and clean
npx mac-cleaner-cli

# Include risky categories
npx mac-cleaner-cli --risky

Remove applications completely with all their preferences, caches, and support files:

npx mac-cleaner-cli uninstall
# Flush DNS cache (may require sudo)
npx mac-cleaner-cli maintenance --dns

# Free purgeable space
npx mac-cleaner-cli maintenance --purgeable
# List all available categories
npx mac-cleaner-cli categories

# Manage configuration
npx mac-cleaner-cli config --init
npx mac-cleaner-cli config --show

# Manage backups
npx mac-cleaner-cli backup --list
npx mac-cleaner-cli backup --clean

If you use this tool frequently:

npm install -g mac-cleaner-cli
mac-cleaner-cli
Open Source All code publicly available for audit
No Network Operates 100% offline
Minimal Deps Only 5 runtime dependencies
CI/CD Every release tested with TypeScript, ESLint, and automated tests
Socket.dev Dependencies monitored for supply chain attacks

Found a vulnerability? Report it via GitHub Security Advisories.

git clone https://github.com/guhcostan/mac-cleaner-cli.git
cd mac-cleaner-cli
npm install
npm run dev      # Run in dev mode
npm test         # Run tests
npm run lint     # Run linter
npm run build    # Build for production

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

If this tool saved you time or disk space, consider supporting the project!

Support on Ko-fi

Your support helps maintain and improve this tool. Thank you! 🙏

MIT License — see LICENSE for details.


⚠️ Disclaimer
This tool deletes files from your system. While we've implemented safety measures, always ensure you have backups of important data.

Made with ❤️ for Mac users everywhere

联系我们 contact @ memedata.com