Mac Storage Optimizer

Mac storage cleaner

by davila7 · MIT license · ★ 32,299 on GitHub

Mac storage cleaner cover

Safely reclaim disk space on a Mac — the trustworthy, transparent, reversible alternative to CleanMyMac and similar tools. Use whenever the user says their Mac disk or storage is full or nearly full, gets a "startup disk almost full" /…

---
name: mac-storage-cleaner
description: Safely reclaim disk space on a Mac — the trustworthy, transparent, reversible alternative to CleanMyMac and similar tools. Use whenever the user says their Mac disk or storage is full or nearly full, gets a "startup disk almost full" / low-storage warning, asks to free up space, clean/clear caches, remove junk, delete leftover files from apps they uninstalled, or find what's eating their disk — in any language (e.g. English "my mac is out of space", "free up disk", "clear caches", "what's taking up my storage"; Georgian "ქეში გაასუფთავე", "მეხსიერება გადამევსო", "ადგილი აღარ მაქვს"). Surveys usage first, auto-clears only pure caches, moves anything riskier to the Trash (restorable), asks before anything expensive, logs every deletion, and reports what was freed. Do NOT use for cloud storage, RAM/memory-pressure, or a single named app's own in-app cache button.
---

# Mac Storage Cleaner

Free disk space the way a careful engineer would, and earn the trust one-click
cleaners lose: **measure first, delete only what provably regenerates, make
anything riskier reversible, ask before anything expensive, log every action,
and report honestly.** The differentiator over CleanMyMac-style tools is
judgment and transparency — the user sees what will go and why, and can undo it.

Scripts live in `scripts/`; the full tiered inventory, exact reclaim commands,
and gotchas are in `references/cache-catalog.md`. Read the catalog whenever you
hit something a script didn't classify or you need the precise command.

## Core principles

Overview

Free disk space the way a careful engineer would, and earn the trust one-click cleaners lose: measure first, delete only what provably regenerates, make anything riskier reversible, ask before anything expensive, log every action, and report honestly. The differentiator over CleanMyMac-style tools is judgment and transparency — the user sees what will go and why, and can undo it.

Manual install (npx, ZIP)
Claude Codenpx skills add davila7/claude-code-templates --skill mac-storage-cleaner -g -a claude-code
Claude Code (degit)npx degit davila7/claude-code-templates/cli-tool/components/skills/productivity/mac-storage-cleaner#main ~/.claude/skills/mac-storage-cleaner
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md8.1 KB
Read SKILL.md here
davila7/main1 file shown
SKILL.md
Show the full text144 lines

Mac Storage Cleaner

Free disk space the way a careful engineer would, and earn the trust one-click cleaners lose: measure first, delete only what provably regenerates, make anything riskier reversible, ask before anything expensive, log every action, and report honestly. The differentiator over CleanMyMac-style tools is judgment and transparency — the user sees what will go and why, and can undo it.

Scripts live in scripts/; the full tiered inventory, exact reclaim commands, and gotchas are in references/cache-catalog.md. Read the catalog whenever you hit something a script didn't classify or you need the precise command.

Core principles

  • Safe tier → delete outright (space back immediately). These are pure caches; the only cost is a slower next build/install.
  • Everything else → Trash, not rm. Ask-tier items, app leftovers, big files — move them to the Trash with trash-items.sh so the user can restore them. Reversibility is the whole point; never hard-delete a user's data.
  • When unsure, demote a tier. A slower rebuild is trivial; deleting a license, an unpushable Xcode archive, or someone's only local backup is not.
  • Every destructive run is logged to ~/Library/Logs/mac-storage-cleaner/operations.log.

Workflow

Locating the scripts. The commands below resolve $D to this skill's own directory so they work whether the skill was installed as a plugin ($CLAUDE_PLUGIN_ROOT is set) or as a standalone skill (~/.claude/skills/…). Shell state doesn't persist between commands, so each block re-resolves $D.

1. Survey — caches (always first, read-only)
D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
bash "$D/scripts/survey.sh"

Prints free space and sizes every cache that exists on this machine, grouped safe / ask / never / app-data. Never skip it — locations and sizes differ on every Mac. Note current free space for the before/after report.

2. Clear the safe tier (no per-item permission needed)

Tell the user briefly what the safe tier removes and roughly how much it frees, then:

D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
bash "$D/scripts/clean-safe.sh"

Removes only the vetted safe allowlist (nothing else — the survey's "other large caches" list is for the user to review, not for auto-deletion), handles read-only files, skips anything macOS protects (reporting rather than failing), runs brew cleanup -s --prune=all and removes unavailable simulators, logs each deletion, and prints what it reclaimed. If the user only wanted specific items, delete those directly instead.

Browser & Electron app caches (Chrome/Arc/Slack/VS Code/…) are safe but live inside app-data folders — clear only the Cache/Code Cache/GPUCache subfolders the survey lists, ideally with the app quit, and never the whole app folder. Exact paths: references/cache-catalog.md.

3. Surface the "ask" tier — recommend, don't delete

Big but not free caches (Docker images, ML models, simulator devices, Xcode Archives, module stores). List each with size + a specific recommendation; let the user choose. Use the tool-native command, and prefer Trash for file deletions. Key ones (full detail in the catalog):

  • Docker — docker system prune -a, never rm the VM disk.
  • ML models (HuggingFace/Ollama) — often duplicated variants; offer to remove unused ones.
  • Simulators — only xcrun simctl delete unavailable is safe; deleting active devices wipes state.
  • Xcode Archives — warn: holds dSYMs for crash symbolication and shippable builds.
4. Go beyond caches — the space the cleaners miss (read-only scan)
D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
bash "$D/scripts/find-extras.sh"

Surfaces the real hogs a cache sweep ignores: leftover data from uninstalled apps, big files (>500MB), stale installers (.dmg/.pkg), and old Downloads. Everything here is ask-tier — present candidates, let the user pick, then remove reversibly:

D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
bash "$D/scripts/trash-items.sh" "/path/one" "/path/two"

If trashing reports "could NOT trash (permissions/TCC?)" for every item, the controlling app hasn't been granted Automation control of Finder — a normal first-run state. Tell the user to allow it in System Settings › Privacy & Security › Automation (enable Finder for the terminal/app), then re-run; or move the item to the Trash manually in Finder. Don't report space as freed when items logged trash-failed — nothing was actually removed.

App leftovers need verification. The scan lists containers whose owning app a quick check couldn't confirm is installed — but Spotlight misses un-indexed apps, so some candidates are still installed. Before proposing to remove any leftover, confirm the app is really gone (check /Applications, mdfind, or just ask the user "do you still use X?"), and always Trash it, never rm. To also clear a confirmed-uninstalled app's other leftovers (Preferences, Application Support, Logs, Saved State, etc.), see the leftover-location list in the catalog.

5. Report

In the user's language: before → after free space (df -h /System/Volumes/Data), a short list of what was cleared/trashed with sizes, a one-line note that the first build/install afterward will be slower, the still-large "ask" items each with a recommendation, and the log path.

If free space rose less than the reclaimed size suggests, explain APFS purgeable space: macOS may hold freed space as purgeable (often behind Time Machine local snapshots) and release it on demand — the space is genuinely recovered. Don't chase it with sudo.

Safety rules

Read references/cache-catalog.md for the full tiered inventory and gotchas. The essentials:

  • Never delete user data that looks like storage: iOS backups (~/Library/Application Support/MobileSync/Backup), Photos library, Mail/Messages data, whole app-support folders, ~/.ssh/~/.aws/keychains, Time Machine snapshots. Report their size so the user knows, but don't touch them.
  • Messaging-app media is user data, not cache. Telegram/WhatsApp/Slack store downloaded photos/videos in their caches. Don't bulk-delete these; point the user to the app's own "Clear Cache" (e.g. Telegram › Settings › Data and Storage › Storage Usage) so they choose what to drop.
  • Never sudo into /System, /Library/Caches, /private/var/folders, or SIP-protected areas — that's macOS's job.
  • Watch mixed directories: ~/.cargo (has installed binaries — only clear registry/), ~/.m2 (has settings.xml — only clear repository/), ~/.gradle (only caches/). ~/.npm is pure cache so it's fine whole.
  • Continue past errors and verify with du; rm -rf on multiple paths keeps going after a failure, so never assume total success or total failure.
1---
2name: mac-storage-cleaner
3description: Safely reclaim disk space on a Mac — the trustworthy, transparent, reversible alternative to CleanMyMac and similar tools. Use whenever the user says their Mac disk or storage is full or nearly full, gets a "startup disk almost full" / low-storage warning, asks to free up space, clean/clear caches, remove junk, delete leftover files from apps they uninstalled, or find what's eating their disk — in any language (e.g. English "my mac is out of space", "free up disk", "clear caches", "what's taking up my storage"; Georgian "ქეში გაასუფთავე", "მეხსიერება გადამევსო", "ადგილი აღარ მაქვს"). Surveys usage first, auto-clears only pure caches, moves anything riskier to the Trash (restorable), asks before anything expensive, logs every deletion, and reports what was freed. Do NOT use for cloud storage, RAM/memory-pressure, or a single named app's own in-app cache button.
4---
5 
6# Mac Storage Cleaner
7 
8Free disk space the way a careful engineer would, and earn the trust one-click
9cleaners lose: **measure first, delete only what provably regenerates, make
10anything riskier reversible, ask before anything expensive, log every action,
11and report honestly.** The differentiator over CleanMyMac-style tools is
12judgment and transparency — the user sees what will go and why, and can undo it.
13 
14Scripts live in `scripts/`; the full tiered inventory, exact reclaim commands,
15and gotchas are in `references/cache-catalog.md`. Read the catalog whenever you
16hit something a script didn't classify or you need the precise command.
17 
18## Core principles
19 
20- **Safe tier → delete outright** (space back immediately). These are pure
21 caches; the only cost is a slower next build/install.
22- **Everything else → Trash, not `rm`.** Ask-tier items, app leftovers, big
23 files — move them to the Trash with `trash-items.sh` so the user can restore
24 them. Reversibility is the whole point; never hard-delete a user's data.
25- **When unsure, demote a tier.** A slower rebuild is trivial; deleting a
26 license, an unpushable Xcode archive, or someone's only local backup is not.
27- **Every destructive run is logged** to `~/Library/Logs/mac-storage-cleaner/operations.log`.
28 
29## Workflow
30 
31**Locating the scripts.** The commands below resolve `$D` to this skill's own
32directory so they work whether the skill was installed as a plugin
33(`$CLAUDE_PLUGIN_ROOT` is set) or as a standalone skill (`~/.claude/skills/…`).
34Shell state doesn't persist between commands, so each block re-resolves `$D`.
35 
36### 1. Survey — caches (always first, read-only)
37 
38```bash
39D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
40bash "$D/scripts/survey.sh"
41```
42 
43Prints free space and sizes every cache that exists on *this* machine, grouped
44**safe / ask / never / app-data**. Never skip it — locations and sizes differ on
45every Mac. Note current free space for the before/after report.
46 
47### 2. Clear the safe tier (no per-item permission needed)
48 
49Tell the user briefly what the safe tier removes and roughly how much it frees,
50then:
51 
52```bash
53D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
54bash "$D/scripts/clean-safe.sh"
55```
56 
57Removes only the vetted safe allowlist (nothing else — the survey's "other large
58caches" list is for the user to review, not for auto-deletion), handles read-only
59files, skips anything macOS protects (reporting rather than failing), runs
60`brew cleanup -s --prune=all` and removes unavailable simulators, logs each
61deletion, and prints what it reclaimed. If the user only wanted specific items,
62delete those directly instead.
63 
64**Browser & Electron app caches** (Chrome/Arc/Slack/VS Code/…) are safe but live
65inside app-data folders — clear only the `Cache`/`Code Cache`/`GPUCache`
66subfolders the survey lists, ideally with the app quit, and **never** the whole
67app folder. Exact paths: `references/cache-catalog.md`.
68 
69### 3. Surface the "ask" tier — recommend, don't delete
70 
71Big but not free caches (Docker images, ML models, simulator devices, Xcode
72Archives, module stores). List each with size + a specific recommendation; let
73the user choose. Use the tool-native command, and prefer Trash for file
74deletions. Key ones (full detail in the catalog):
75 
76- **Docker** — `docker system prune -a`, never `rm` the VM disk.
77- **ML models** (HuggingFace/Ollama) — often duplicated variants; offer to remove unused ones.
78- **Simulators** — only `xcrun simctl delete unavailable` is safe; deleting active devices wipes state.
79- **Xcode Archives** — warn: holds dSYMs for crash symbolication and shippable builds.
80 
81### 4. Go beyond caches — the space the cleaners miss (read-only scan)
82 
83```bash
84D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
85bash "$D/scripts/find-extras.sh"
86```
87 
88Surfaces the real hogs a cache sweep ignores: **leftover data from uninstalled
89apps**, **big files (>500MB)**, **stale installers** (.dmg/.pkg), and **old
90Downloads**. Everything here is ask-tier — present candidates, let the user pick,
91then remove reversibly:
92 
93```bash
94D="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/mac-storage-cleaner}"; D="${D:-$HOME/.claude/skills/mac-storage-cleaner}"
95bash "$D/scripts/trash-items.sh" "/path/one" "/path/two"
96```
97 
98**If trashing reports "could NOT trash (permissions/TCC?)"** for every item, the
99controlling app hasn't been granted Automation control of Finder — a normal
100first-run state. Tell the user to allow it in System Settings › Privacy &
101Security › Automation (enable Finder for the terminal/app), then re-run; or move
102the item to the Trash manually in Finder. Don't report space as freed when items
103logged `trash-failed` — nothing was actually removed.
104 
105**App leftovers need verification.** The scan lists containers whose owning app a
106quick check couldn't confirm is installed — but Spotlight misses un-indexed apps,
107so some candidates *are* still installed. Before proposing to remove any leftover,
108**confirm the app is really gone** (check `/Applications`, `mdfind`, or just ask
109the user "do you still use X?"), and always Trash it, never `rm`. To also clear a
110confirmed-uninstalled app's *other* leftovers (Preferences, Application Support,
111Logs, Saved State, etc.), see the leftover-location list in the catalog.
112 
113### 5. Report
114 
115In the user's language: before → after free space
116(`df -h /System/Volumes/Data`), a short list of what was cleared/trashed with
117sizes, a one-line note that the first build/install afterward will be slower, the
118still-large "ask" items each with a recommendation, and the log path.
119 
120If free space rose less than the reclaimed size suggests, explain **APFS
121purgeable space**: macOS may hold freed space as purgeable (often behind Time
122Machine local snapshots) and release it on demand — the space is genuinely
123recovered. Don't chase it with `sudo`.
124 
125## Safety rules
126 
127Read `references/cache-catalog.md` for the full tiered inventory and gotchas. The essentials:
128 
129- **Never delete** user data that looks like storage: iOS backups
130 (`~/Library/Application Support/MobileSync/Backup`), Photos library, Mail/Messages
131 data, whole app-support folders, `~/.ssh`/`~/.aws`/keychains, Time Machine
132 snapshots. Report their size so the user knows, but don't touch them.
133- **Messaging-app media is user data, not cache.** Telegram/WhatsApp/Slack store
134 downloaded photos/videos in their caches. Don't bulk-delete these; point the
135 user to the app's own "Clear Cache" (e.g. Telegram › Settings › Data and
136 Storage › Storage Usage) so they choose what to drop.
137- **Never `sudo`** into `/System`, `/Library/Caches`, `/private/var/folders`, or
138 SIP-protected areas — that's macOS's job.
139- **Watch mixed directories**: `~/.cargo` (has installed binaries — only clear
140 `registry/`), `~/.m2` (has `settings.xml` — only clear `repository/`), `~/.gradle`
141 (only `caches/`). `~/.npm` is pure cache so it's fine whole.
142- **Continue past errors and verify** with `du`; `rm -rf` on multiple paths keeps
143 going after a failure, so never assume total success or total failure.
144 
View all files on GitHub →

Details

License
MIT
Stars on the repo
★ 32,299
Checked
Source
davila7/claude-code-templates ↗
Creator
davila7 · 212 listings
View creator

Similar skills

See all →

More from davila7

Skill2D Game Developmentdavila7/claude-code-templates · by davila72D game development principles. Sprites, tilemaps, physics, camera.★ 32.3k GitHub starsSkill3D Game Development Principlesdavila7/claude-code-templates · by davila73D game development principles. Rendering, shaders, physics, cameras.★ 32.3k GitHub starsSkill3D Web Experience Builderdavila7/claude-code-templates · by davila7Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.★ 32.3k GitHub starsSkillSplit Test Setupdavila7/claude-code-templates · by davila7When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," or "hypothesis." For tracking implementation, see analytics-tracking.★ 32.3k GitHub starsAgentResearch Literature Synthesizerdavila7/claude-code-templates · by davila7Academic research synthesis specialist. Use PROACTIVELY for comprehensive research on academic topics, literature reviews, technical investigations, and well-cited analysis combining multiple sources. <example>Context: A podcast episode needs a segment grounded in peer-reviewed evidence with formal citations. user: "Research the current state of transformer efficiency techniques for the episode, with proper academic citations." assistant: "I'll use the academic-research-synthesizer agent to search arXiv and Semantic Scholar, extract full-text findings via WebFetch, and produce a cited literature synthesis with confidence levels." <commentary>Use academic-research-synthesizer (not comprehensive-researcher) when the episode segment needs peer-reviewed sourcing, formal citation format, and explicit confidence tagging rather than general-purpose multi-source coverage.</commentary></example> <example>Context: The episode-orchestrator has routed a "literature review" request for a technical deep-dive segment. user: "Summarize the research landscape on federated learning privacy guarantees." assistant: "I'll invoke academic-research-synthesizer to systematically search academic sources, note peer-review status per source, and synthesize consensus vs. open debates."</example>★ 32.3k GitHub starsAgentAcademic Research Specialistdavila7/claude-code-templates · by davila7Academic research specialist for scholarly sources, peer-reviewed papers, and academic literature. Use PROACTIVELY for research paper analysis, literature reviews, citation tracking, and academic methodology evaluation. <example>Context: The research-orchestrator has kicked off Phase 4 parallel research on 'efficacy of intermittent fasting' and needs peer-reviewed evidence. user: "Find the academic evidence on intermittent fasting outcomes." assistant: "I'll use the academic-researcher agent to search Semantic Scholar, PubMed, and OpenAlex for peer-reviewed studies and write structured findings to academic-research.md." <commentary>The request is specifically for scholarly/peer-reviewed evidence rather than general web coverage or code, so academic-researcher (not web-researcher or technical-researcher) is the right specialist.</commentary></example> <example>Context: The user wants a literature review comparing methodologies across studies on a topic. user: "Can you review the literature on transformer model interpretability and identify research gaps?" assistant: "Let me invoke the academic-researcher agent to pull foundational and recent papers, extract methodologies, and surface open research gaps." <commentary>Literature review, methodology extraction, and research-gap identification are core academic-researcher capabilities, distinct from technical-researcher's focus on code repositories and implementations.</commentary></example>★ 32.3k GitHub stars