New to Claude Skills? Learn how to install them →

Mdavila7 on GitHub

Mac Storage Cleaner

Free

Reclaim disk space safely and transparently on macOS.

Get this skill

Free · Opens the source repo

What Mac Storage Cleaner does

Mac Storage Cleaner is a bash-based skill designed for macOS users who need to free up disk space without the risks associated with typical one-click cleaners. This tool prioritizes safety and transparency, allowing users to reclaim space by measuring first and deleting only what is necessary. It offers a tiered approach to cleaning, categorizing items into safe deletions, items that require user confirmation, and those that should never be deleted. By following these principles, the skill ensures that users can trust the process and feel confident that their important data remains intact.

The skill operates through a series of scripts that survey the user's disk usage, identify cache files, and suggest safe deletions. Users can run the survey.sh script to see what caches exist on their system, grouped into categories like safe, ask, and never. The clean-safe.sh script then removes only the vetted safe caches, while the find-extras.sh script helps identify leftover data from uninstalled apps and large files that may be taking up unnecessary space. This systematic approach helps users understand what is being removed and why, fostering an informed cleaning process.

One of the key features of Mac Storage Cleaner is its commitment to reversibility. Any items that are deemed riskier to delete are moved to the Trash instead of being permanently removed, allowing users to restore them if needed. The skill logs every action taken, providing a clear record of what has been deleted and how much space has been reclaimed. This level of detail is particularly beneficial for users who want to maintain control over their system's storage while still achieving a cleaner environment.

This skill is ideal for developers, designers, and everyday macOS users who frequently encounter storage warnings or need to clear space for new projects. It is a practical solution for those who prefer a hands-on approach to managing their disk space, ensuring that they can safely optimize their system without the fear of losing critical data.

When to use it

Use this tool when your Mac displays low-storage warnings or when you want to free up space without using risky one-click cleaners.

When not to use it

This skill is not suitable for managing cloud storage or memory pressure issues, nor should it be used for specific app cache clearing that is best handled within the app itself.

What you can build with it

Clearing Cache Files

Run the `survey.sh` script to identify and clear safe cache files that can be deleted without risk.

Managing Uninstalled App Leftovers

Use the `find-extras.sh` script to locate and remove leftover data from apps that have already been uninstalled.

Monitoring Disk Space Usage

Regularly survey your disk space with this skill to keep track of what's taking up space and manage it effectively.

How to install Mac Storage Cleaner

View source

1. Install with the skills CLI

npx skills add davila7/claude-code-templates/mac-storage-cleaner --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by davila7

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):

  • Dockerdocker 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.

Frequently asked questions about Mac Storage Cleaner

Similar skills