A powerful macOS disk cleanup CLI written in TypeScript. Inspired by Mole.
- Features
- Installation
- Quick Start
- Commands
- Usage Examples
- Cleanup Categories
- Configuration
- Documentation
- Tech Stack
- License
- π§Ή Deep Cleaning - Remove caches, logs, trash, browser data, and dev artifacts
- ποΈ Smart Uninstall - Completely remove apps and their leftover files
- β‘ System Optimization - Flush DNS, rebuild Spotlight, purge memory
- π Disk Analysis - Visualize disk usage with interactive drill-down
- π» System Monitoring - Real-time CPU, memory, disk, and network dashboard
- π₯ Project Purge - Clean build artifacts (node_modules, target, dist, etc.)
- π¦ Installer Cleanup - Find and remove old installer files
- π Duplicate Finder - Locate and remove duplicate files
- π HTML Reports - Generate detailed cleanup reports with charts
- βοΈ Configuration - Whitelist/blacklist paths, customize safety levels
- π©Ί Health Check - Run system diagnostics
- πΎ Backup & Restore - Safe file backup before cleanup
- β° Scheduler - Automate cleanup tasks
- ποΈ Directory Watch - Monitor directory sizes
- π Touch ID - Sudo authentication with Touch ID
- π Shell Completion - Tab completion for Bash, Zsh, Fish
# Clone the repository
git clone https://github.com/your-username/broom.git
cd broom
# Install dependencies
bun install # or npm install
# Build the project
bun run build # or npm run build
# Link globally (optional)
bun link
# Run projects
broom <command> <option>
# or
bun run dev <command> <option>
# or
bun dist/index.js <command> <option>
# CLI help windows
broom --help# Interactive cleanup - scan and select categories
broom clean
# Preview mode - see what would be cleaned
broom clean --dry-run
# Clean all safe categories automatically
broom clean --all --yes
# Generate HTML report after cleanup
broom clean --report --open
# Analyze disk usage
broom analyze
# System status dashboard
broom status --watch
# Complete uninstall of an app
broom uninstall| Command | Description | Key Options |
|---|---|---|
clean |
Deep system cleanup | --dry-run, --all, --yes, --unsafe, --report, --open |
analyze |
Disk space analysis | --path <path>, --depth <n>, --limit <n> |
status |
System resource monitoring | --watch, --interval <ms> |
uninstall |
Remove apps completely | --dry-run, --yes |
optimize |
System maintenance | --dry-run, --yes, --all |
| Command | Description | Key Options |
|---|---|---|
purge |
Clean project artifacts | --dry-run, --yes, --path <path> |
installer |
Remove installer files | --dry-run, --yes |
duplicates |
Find duplicate files | --path <path>, --min-size <size>, --interactive |
reports |
Manage cleanup reports | list, clean, open, --yes |
backup |
Create file backups | --path <path>, --tag <name> |
restore |
Restore from backup | --tag <name>, --path <path> |
| Command | Description | Subcommands |
|---|---|---|
config |
Manage settings | show, set <key> <value>, reset, path |
touchid |
Touch ID for sudo | enable, disable, status |
completion |
Shell completion | bash, zsh, fish, install |
doctor |
System diagnostics | - |
schedule |
Automate cleanups | add, remove, list |
watch |
Monitor directories | --add, --remove, --list, --check |
| Command | Description | Options |
|---|---|---|
update |
Update broom | - |
remove |
Uninstall broom | --yes |
help |
Display help | [command] |
# Interactive cleanup with category selection
broom clean
# Dry run - preview without deleting
broom clean --dry-run
# Clean all safe categories without prompts
broom clean --all --yes
# Include risky categories (downloads, trash)
broom clean --unsafe --yes
# Generate HTML report with charts
broom clean --report --open
# Clean specific categories interactively
broom clean # then select from menu# Analyze home directory
broom analyze
# Analyze specific path with depth
broom analyze --path ~/Library --depth 3
# Show top 20 largest items
broom analyze --limit 20
# Analyze entire disk
broom analyze --path / --depth 2# Show current system status
broom status
# Live monitoring dashboard
broom status --watch
# Custom refresh interval (500ms)
broom status --watch --interval 500# Uninstall app with interactive selection
broom uninstall
# Preview uninstall without deleting
broom uninstall --dry-run
# Uninstall without confirmation
broom uninstall --yes# Run all optimization tasks
broom optimize --all
# Preview optimization tasks
broom optimize --dry-run
# Tasks include:
# - Flush DNS cache
# - Rebuild Spotlight index
# - Purge memory cache
# - Verify disk
# - Repair permissions# Clean current directory
broom purge
# Clean specific project
broom purge --path ~/projects/myapp
# Preview what would be cleaned
broom purge --dry-run
# Cleans: node_modules, target, dist, build, .next, etc.# Find duplicates in home directory
broom duplicates
# Scan specific path with size filter
broom duplicates --path ~/Documents --min-size 1MB
# Interactive mode to choose what to keep
broom duplicates --interactive
# Custom hash algorithm
broom duplicates --hash md5# List all generated reports
broom reports
broom reports list
# Delete all reports
broom reports clean
# Delete without confirmation
broom reports clean --yes
# Open latest report in browser
broom reports open# Backup important files
broom backup --path ~/Documents --tag "before-cleanup"
# List backups
broom backup --list
# Restore from backup
broom restore --tag "before-cleanup"
# Restore to different location
broom restore --tag "backup-001" --path ~/restored# Show current configuration
broom config show
# Set safety level (safe, moderate, aggressive)
broom config set safetyLevel moderate
# Add path to whitelist
echo ~/important-folder >> ~/.config/broom/whitelist
# View config file location
broom config path
# Reset to defaults
broom config reset# Install for current shell (auto-detect)
broom completion install
# Generate for specific shell
broom completion bash > /usr/local/etc/bash_completion.d/broom
broom completion zsh > ~/.zsh/completions/_broom
broom completion fish > ~/.config/fish/completions/broom.fish
# Zsh manual setup
broom completion zsh > ~/.zsh/completions/_broom
# Add to ~/.zshrc: fpath=(~/.zsh/completions $fpath)# Enable Touch ID for sudo
broom touchid enable
# Check status
broom touchid status
# Disable Touch ID
broom touchid disable# Schedule weekly cleanup
broom schedule add --weekly
# Schedule daily at 2 AM
broom schedule add --daily --time 02:00
# List scheduled tasks
broom schedule list
# Remove schedule
broom schedule remove <id># Add directory to watch
broom watch --add --path ~/Downloads --threshold 1GB
# List watched directories
broom watch --list
# Check all watches now
broom watch --check
# Remove watch
broom watch --remove ~/DownloadsAlways safe to clean without risk of data loss:
- User Cache -
~/Library/Caches(app caches) - User Logs -
~/Library/Logs(application logs) - Browser Cache - Chrome, Safari, Firefox, Edge, Brave, Arc
- Temporary Files -
/tmp,/var/folders
Generally safe but review before cleaning:
- Development Cache - npm, yarn, pip, cargo, gradle, Maven
- Xcode Cache - DerivedData, Archives, DeviceSupport
- Homebrew Cache - Downloaded packages
- Docker Cache - Build cache, unused images
- Node Modules - In workspace (check before deleting)
- iOS Simulator - Simulator data
May contain important files - review carefully:
- Trash -
~/.Trash(deleted files) - Downloads -
~/Downloads(old files) - iOS Backups - iPhone/iPad backups
- Installer Packages -
.dmg,.pkgfiles
- Config directory:
~/.config/broom/ - Main config:
~/.config/broom/config.json - Whitelist:
~/.config/broom/whitelist - Reports:
~/.broom/reports/
Create ~/.config/broom/whitelist:
# Protected paths (one per line)
~/Documents/important-project
~/Library/Application Support/MyApp
/Volumes/External/backup
{
"safetyLevel": "safe", // safe, moderate, aggressive
"dryRun": false,
"confirmBeforeDelete": true,
"excludePaths": [],
"scanDepth": 3
}All commands support these options:
| Option | Description |
|---|---|
-v, --version |
Display version number |
-h, --help |
Display help information |
--debug |
Enable debug logging |
Detailed documentation available in the docs/ directory:
- COMMANDS.md - Complete command reference
- HTML_REPORT.md - HTML report features
- SCANNERS.md - Scanner implementation details
- MIGRATION.md - Migration from Mole
- README.md - Full project documentation (Japanese)
- TypeScript - Type-safe development
- Node.js 18+ - Runtime environment
- Commander.js - CLI framework and argument parsing
- @inquirer/prompts - Interactive prompts and menus
- chalk - Terminal string styling
- ora - Elegant terminal spinners
- systeminformation - System monitoring and hardware info
- fast-glob - Fast file pattern matching
- handlebars - HTML template engine for reports
- cli-progress - Beautiful progress bars
- ESLint - Code linting
- Prettier - Code formatting
- tsup - TypeScript bundler
- bun - Fast package manager (optional)
broom/
βββ src/
β βββ commands/ # Command implementations
β β βββ clean.ts
β β βββ analyze.ts
β β βββ status.ts
β β βββ ...
β βββ scanners/ # File scanners
β β βββ base.ts
β β βββ browser-cache.ts
β β βββ ...
β βββ ui/ # User interface
β β βββ output.ts # Formatted output
β β βββ prompts.ts # Interactive prompts
β βββ utils/ # Utility functions
β β βββ fs.ts # File system utilities
β β βββ config.ts # Configuration
β β βββ report.ts # HTML report generator
β βββ types/ # TypeScript types
β βββ index.ts # Entry point
βββ docs/ # Documentation
βββ dist/ # Compiled output
βββ package.json
# Install dependencies
bun install
# Development mode with auto-reload
bun run dev
# Build for production
bun run build
# Run tests
bun test
# Lint code
bun run lint
# Format code
bun run format
# Type check
bun run typecheckContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see the LICENSE file for details.
Made with β€οΈ by the Broom team