Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
cleanmymac-cli

cleanmymac-cli

> 开发工具
Free

Clean Xcode, Docker, Homebrew, and developer caches, remove project and AI artifacts, analyze storag

951 stars0 likes1 views
GitHub

About

Clean Xcode, Docker, Homebrew, and developer caches, remove project and AI artifacts, analyze storag

Built and used daily by the CleanMyMac team on our own Macs

Developer storage builds up across Docker, Xcode, package managers, project folders, and AI tools. CleanMyMac CLI brings those leftovers into one place, shows what can be removed, and leaves the final decision to you.

CleanMyMac CLI is currently in public beta. Commands and behavior may evolve as we improve the experience.

Features

  • Developer Cleanup: Clears caches, build artifacts, and system junk across common developer tools (see Commands)
  • Artifact Purging: Removes old build artifacts using age-based selection
  • Disk Analysis: Reports on disk usage to show what is consuming storage
  • Interactive Review: Prompts for confirmation before deletion; protected system locations; cleanup logic shared with CleanMyMac
  • Terminal-Based: Scriptable commands intended for command-line workflows
  • Privacy Controls: No source code or personal files are uploaded; analytics can be disabled via configuration
  • Optimization: Runs quick performance tasks from the command line

Requirements

  • macOS 11 or later, Homebrew

Installation

The formula lives in our tap — MacPaw/homebrew-taps

The fastest way to install CleanMyMac CLI is with Homebrew:

brew install --cask cleanmymac-cli

Verify the installation:

cleanmymac --version

Then launch the interactive interface:

cleanmymac

Or start by analyzing what is taking up space:

cleanmymac analyze

! Both cleanmymac and cmm run the same tool.

Quick Start

Getting Started · Commands · Safety & Privacy · FAQ


What can CleanMyMac CLI do?

Clean developer caches and system junk

Find removable files created by developer tools, package managers, Xcode, AI tools, and macOS:

cleanmymac clean

Scan a specific cleanup category:

cleanmymac clean dev
cleanmymac clean junk
cleanmymac clean ai
cleanmymac clean trash

CleanMyMac CLI can detect caches and generated files from tools including: Homebrew, npm, Yarn, and pnpm, pip, Poetry, and uv, Xcode DerivedData, Device Support, Module Cache, and other Xcode-related files, supported AI-tool artifacts etc

You review detected items before cleanup.


Remove old project artifacts

Development projects accumulate generated files that can take gigabytes of disk space: node_modules, .next, .turbo, target, .build etc

Find them across common project folders:

cleanmymac purge

Or scan a specific directory:

cleanmymac purge ~/Projects

Results are grouped by project so you know what each artifact belongs to.

Artifacts older than seven days are preselected. Newer artifacts remain visible but unchecked for manual review.

[!TIP] Use clean for shared caches and tool-generated junk.
Use purge for removable dependencies and build artifacts stored inside project folders.


Analyze disk usage from Terminal

Not sure where your disk space went?

Open the interactive storage analyzer:

cleanmymac analyze

Or start from a specific folder:

cleanmymac analyze ~/Projects

Navigate through directories by size, explore what is consuming storage, and reveal items in Finder.

Browsing through the analyzer does not modify your files. Any removal action requires an explicit selection and confirmation.

[!TIP] If your Mac is running out of storage and you are not sure what is safe to remove, start with cleanmymac analyze.


Optimize your Mac

Run lightweight maintenance tasks directly from Terminal:

cleanmymac optimize

Or run them separately:

cleanmymac optimize ram
cleanmymac optimize purgeable
  • optimize ram releases inactive memory
  • optimize purgeable asks macOS to release disk space already marked as purgeable

These commands do not remove project source code or personal documents.


Preview first. Delete only what you approve.

CleanMyMac CLI is designed around transparency and control.

Before cleanup, you can inspect what was detected and decide what should be removed.

Safety features include:

  • Interactive review before cleanup
  • Protected system locations excluded from cleanup
  • Project-aware purging with age-based selection
  • Ignore list for files and folders you always want protected
  • Explicit confirmation before removal
  • Cleanup detection based on logic shared with CleanMyMac

Protect a path permanently:

cleanmymac ignore add ~/Projects/important-project

View protected paths:

cleanmymac ignore list

Remove a path from the ignore list:

cleanmymac ignore remove ~/Projects/important-project

[!WARNING] --force skips interactive confirmation for supported cleanup commands and removes detected items immediately. Run the command without --force first and review what it finds.

Learn more: Safety and Privacy


Commands

Command Description
clean Runs all clean categories at once: system junk, dev-tools junk, and trash
clean ai Scans for junk created by AI tools, shows what can be safely removed, and cleans it after your confirmation
clean dev Clears cached packages and build files left by developer tools: Homebrew, npm, Yarn, pnpm, pip, Cargo, Go, CocoaPods, Docker, VS Code, JetBrains, Maven, Gradle, Poetry, uv, Bun, Deno, and mise
clean junk Clears user logs, Xcode DerivedData, Device Support, Module Cache, Documentation Cache, and other Xcode-related junk
clean trash Empties the system trash and mounted-volume trash bins
clean --force Deletes immediately, skipping the confirmation prompt
purge Scans developer folders (~/Projects, ~/Code, ~/dev, ~/GitHub, ~/Workspace) and lists removable build artifacts grouped by project for review. Detects node_modules, .next, .turbo, target, .build, .venv, venv, pycache, Pods, DerivedData, vendor, and cmake-build-*. Artifacts older than 7 days are preselected; newer ones are shown unchecked
purge Scans a specific folder for removable project artifacts
analyze Opens an interactive disk usage explorer
analyze Explores disk usage within a specific folder
optimize Frees RAM and purgeable disk space in one command
optimize ram Releases inactive memory (no sudo required)
optimize purgeable Clears space macOS has marked as purgeable but not yet released
config Opens CLI settings, including the analytics toggle
ignore add Adds a path to the ignore list so it never appears in clean, purge, or analyze results

For detailed examples, see the Commands documentation.

Guides

Solve common developer storage problems with practical step-by-step guides:

  • Clean Xcode Cache and DerivedData from Terminal
  • Clean Developer Caches on macOS
  • Find and Remove Old node_modules on Mac
  • Analyze Disk Usage on macOS from Terminal
  • Clean AI Tool Artifacts on macOS


How it works — in details

A typical cleanup takes three steps:

1. Scan

cleanmymac clean/purge

CleanMyMac CLI scans supported locations and groups what it finds.

2. Review

Inspect categories and paths, then select or deselect what you want to remove.

3. Confirm

After cleanup, CleanMyMac CLI shows what was removed and how much disk space was recovered.


Interactive or direct — your choice

Open the interactive interface or run exactly what you need. This makes CleanMyMac CLI useful both as an interactive cleanup tool and as part of command-line workflows.

cleanmymac
…
Run:
    M
    
    cleanmymac clean                    Scan and review junk on your Mac
    cleanmymac clean junk               Scan and review system junk only
    cleanmymac clean dev                Scan and review developer-tool junk only
    cleanmymac clean ai                 Scan and review ai-tool junk only
    cleanmymac clean trash              Scan and review items in Trash only
      --force                           Skip confirmation and clean immediately
    
    cleanmymac purge                    Find project artifacts in common developer folders
    cleanmymac purge              Scan a specific directory for project artifacts
      --force                           Skip confirmation and clean immediately
    
    cleanmymac analyze                  Explore storage usage in your home directory
    cleanmymac analyze            Explore storage usage inside a specific directory
    
    cleanmymac optimize                 Free RAM and release purgeable disk space
    cleanmymac optimize ram             Release inactive memory
    cleanmymac optimize purgeable       Release purgeable disk space
    
    cleanmymac config                   Manage CLI preferences
    
    cleanmymac ignore list              Show ignored paths
    cleanmymac ignore add         Add a path to the ignore list
    cleanmymac ignore remove      Remove a path from the ignore list
    
    cleanmymac --help                   Show all commands and options
    cleanmymac --version                Show the installed version
    
    cleanmymac cat                      Summon a friend
    
    Esc Back to menu  ·  Q Quit
    beta · cleanmymac.com · lovingly crafted by MacPaw
> ⚠️ The `--force` flag skips interactive confirmation for supported cleanup commands. Use it only after reviewing what the command detects without the flag.

---

### Clean developer, system, and AI junk

Use `clean` for leftovers created outside individual project folders: package-manager caches, Xcode files, developer-tool data, AI-tool artifacts, user logs, and Trash.

CleanMyMac CLI scans first and groups the results by category:

```text
          $ cleanmymac clean
          
          ← Back to menu
          23.79 GB of items found
          
          Scan results
          Select items you'd like to remove
          
          ▸ ■ System Junk       631 KB  →
            ■ Dev Tools        23.43 GB →
            □ AI Junk          358.7 MB →
          
          40 items selected (23.43 GB)
          
          ↑↓←→ Navigate  ·  Enter Confirm  ·  Space Toggle  ·  A Select all
          Esc Back to menu  ·  Q Quit
          
          beta · cleanmymac.com · lovingly crafted by MacPaw

Press → to open a category and inspect its contents. Use Space to select or deselect individual items. Nothing is removed until you review the selection and confirm the cleanup.

After cleanup, CleanMyMac CLI shows exactly what was removed and how much space was recovered:

          Cleanup complete!
          
          Dev Tools
              ✓ Homebrew       6.61 GB
              ✓ npm            5.03 GB
              ✓ Yarn           3.3 GB
              ✓ pnpm           4.72 GB
              ✓ pip            3.77 GB
          
          AI J

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

clideveloper-toolshomebrew

No comments yet. Be the first to share.

> Details

PublishedSep 9, 2026
UpdatedSep 17, 2026
Category开发工具
PricingFree

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具