Skip to content

A safe and user-friendly macOS cache cleaning script | 安全易用的macOS缓存清理工具

License

Notifications You must be signed in to change notification settings

ThendCN/macos-cache-cleaner

Repository files navigation

macOS Cache Cleaner

English | 中文

English

A safe and user-friendly macOS cache cleaning script that helps you quickly clean various caches and temporary files to free up disk space.

Features

  • Safe: Preview mode with confirmation before cleaning
  • Smart: Different cleaning strategies for different cache types
  • Interactive: Selectively clean specific items
  • Logging: Automatic cleaning logs for tracking
  • Compatible: Works with macOS default bash 3.2+

Quick Start

# Clone the repository
git clone https://github.com/ThendCN/macos-cache-cleaner.git
cd macos-cache-cleaner

# Make script executable
chmod +x clean_cache.sh

# View available cache space
./clean_cache.sh -s

# Preview cleaning operations (recommended for first use)
./clean_cache.sh -d

# Interactive cleaning
./clean_cache.sh

Usage

./clean_cache.sh [options]

Options:
  -h, --help          Show help information
  -s, --scan          Scan only, no cleaning
  -d, --dry-run       Preview mode, show what would be cleaned
  -a, --auto          Auto clean all caches (use with caution)

Supported Cache Types

  • Application Caches (~/Library/Caches)
  • System Logs (~/Library/Logs)
  • Generic Cache (~/.cache)
  • npm Cache (~/.npm)
  • Chrome Cache
  • Trash (~/.Trash)
  • Yarn Cache
  • Gradle Cache
  • Xcode Derived Data

License

MIT License - See LICENSE file for details


中文

一个安全、易用的 macOS 缓存清理脚本,可帮助你快速清理各类缓存和临时文件,释放磁盘空间。

主要特性

  • 安全性: 提供预览模式,清理前二次确认
  • 智能清理: 针对不同类型的缓存采用不同的清理策略
  • 交互式: 可选择性清理指定项目
  • 日志记录: 自动生成清理日志,便于追踪
  • 兼容性: 兼容 macOS 默认的 bash 3.2+

快速开始

# 克隆仓库
git clone https://github.com/ThendCN/macos-cache-cleaner.git
cd macos-cache-cleaner

# 添加执行权限
chmod +x clean_cache.sh

# 查看可清理空间
./clean_cache.sh -s

# 预览清理操作(推荐第一次使用)
./clean_cache.sh -d

# 交互式清理
./clean_cache.sh

使用说明

./clean_cache.sh [选项]

选项:
  -h, --help          显示帮助信息
  -s, --scan          仅扫描不清理
  -d, --dry-run       预览模式,不实际删除文件
  -a, --auto          自动清理所有缓存(需谨慎使用)

支持的缓存类型

  • 应用程序缓存 (~/Library/Caches)
  • 系统日志文件 (~/Library/Logs)
  • 通用缓存目录 (~/.cache)
  • npm缓存 (~/.npm)
  • Chrome浏览器缓存
  • 废纸篓 (~/.Trash)
  • Yarn缓存
  • Gradle缓存
  • Xcode派生数据

许可证

MIT License - 详见 LICENSE 文件

贡献

欢迎提交 Issue 和 Pull Request!

注意事项

  1. 应用程序缓存保留最近7天的文件
  2. npm/Yarn缓存清理后会在下次安装包时自动重建
  3. Chrome缓存清理后首次打开网页可能较慢
  4. 废纸篓清空后文件无法恢复
  5. Xcode派生数据清理后下次构建时间会增加

详细文档请查看 README.md

About

A safe and user-friendly macOS cache cleaning script | 安全易用的macOS缓存清理工具

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages