{"data":{"slug":"discovered-6ee6a63a09e5e4d22dabb068af8998ab5e23591a1ebcefcb","title":"Charles Storage Cleanup for macOS","summary":"Analyzes disk usage on a macOS system to identify safe files for deletion, providing detailed reports and measured cleanup based on user authorization.","url":"https:\/\/skillshunter.net\/skills\/discovered-6ee6a63a09e5e4d22dabb068af8998ab5e23591a1ebcefcb","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-6ee6a63a09e5e4d22dabb068af8998ab5e23591a1ebcefcb","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-6ee6a63a09e5e4d22dabb068af8998ab5e23591a1ebcefcb.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-6ee6a63a09e5e4d22dabb068af8998ab5e23591a1ebcefcb\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before running the cleanup, ensure Python 3 is installed and the audit directory is created outside of any Git repositories. The script reads metadata only and never deletes files without explicit user authorization.","instructions":"---\nname: charles-storage-cleanup\ndescription: \"Finds what is filling a Mac's disk and cleans only what is safe: measures usage, explains recent growth, finds rarely used apps and overlooked caches, runtimes, simulators and build output, and deletes only what the request authorizes while protecting active work. Use when the Mac is out of space or the disk is full, or someone asks what is taking up storage or what is safe to delete.\"\ncompatibility: \"macOS. Python 3 (standard library only) for scripts\/inventory.py. Uses du, df, ps, lsof and mdls, plus the native tools of whatever it cleans (xcrun simctl, avdmanager, npm, conda and the like).\"\n---\n\n# Storage cleanup\n\nFree real space on the Mac's data volume without losing anything someone still needs. The result is the change in free bytes on that volume, measured before and after. The size of what was deleted isn't the result: APFS clones and snapshots share blocks, so deleting a 40 GB folder can free almost nothing.\n\n## What the request allows\n\n- **\"Clean up\", \"delete\", \"free up space\"** allows deleting what this skill confirms is disposable, without asking again for each item. Why: the person asked for the result, and a question per cache wastes their time.\n- **\"What's taking space\", \"report only\", \"don't delete\"** is read-only. Measure and list. Change nothing.\n- **Loading this skill allows nothing.** Only the person's own words do.\n- **Their choices carry forward** across passes: the items they picked, what they said to keep, age limits (\"older than a month\") and recent-use conditions. \"Look in more places\" never cancels an earlier \"keep X\". Why: a later pass that forgets a keep deletes something they protected.\n- **A generic \"clear unused files\" never covers** source code, uncommitted work, credentials, unique research or media, current releases, or the data inside VMs and containers. Those need the person to name them.\n\n## Always keep\n\n- **Anything in use:** running apps, builds, Git operations, emulators and their data. Never stop a job to make its files deletable. Why: a killed build, or a cache cleared under a running install, breaks someone's work, and the space comes back anyway.\n- **Anything uncertain.** An old modification date, an ignored-by-Git status or the lack of an open file handle doesn't prove a thing is disposable on its own. Skip it, say why, and keep cleaning elsewhere.\n- **Anything a check couldn't clear.** A probe that failed, timed out or was cut short means \"use unknown\", not \"unused\". Missing last-use metadata on an app means unknown too.\n\n## Pick the depth\n\n- **A named target** (\"delete the Android emulators\", \"uninstall DaVinci\"): inspect that selection and what depends on it, then finish it. A whole-app uninstall includes the app's own helpers and startup registrations; a cache-only cleanup doesn't.\n- **A general cleanup, an unused-app review, \"what else?\", \"look harder\":** walk [the discovery checklist](references\/discovery.md) through every family: installed software, both Library trees, hidden package stores, runtimes, developer and research output, devices, media and downloads, and storage macOS manages. Never stop at the biggest project or at `~\/Library\/Caches`. Why: forgotten space is usually spread across many 200 MB to 2 GB stores, not one giant folder.\n- **\"Why is this folder so big?\":** split it into source, generated output, installed environments, Git history and unique assets, and say what the largest pieces actually hold and why they exist before suggesting any removal.\n\n## Run it\n\n1. **Baseline.** Record the local time, the data volume's free bytes (`df -k \/System\/Volumes\/Data`), earlier cleanup receipts, mounts and what's running. Keep the audit private and outside every Git repository, in `~\/Library\/Logs\/storage-cleanup\/<date-time>\/`. Start with directory sizes that stay on one filesystem (`du -x`), hidden folders and shared app data included, then go deeper only into the large branches, with time limits on each probe.\n2. **Cover every family** (broad audits). Mark each one measured, absent, excluded or not fully inspected. Follow configured cache and SDK locations, sibling projects and agent workspaces. After a big removal, look again at the smaller stores it was hiding. A path already deleted, or an old measurement, isn't a new opportunity.\n3. **Prove each candidate is disposable and idle.** Walk \"Safe to delete?\" below. Check processes, their arguments and working folders, open files and running devices, and check again right before deleting.\n4. **Delete in measured batches.** Log each exact path, its size, the reason, what rebuilds it and how it was removed. Prefer the tool's own command (`xcrun simctl delete`, `avdmanager delete avd`, `npm cache clean --force`, `conda clean`). For a direct removal, check the exact path, never follow a symlink to its target, and keep any custom data or local patches inside it. Write every target as a literal absolute path: agent safety checks refuse recursive removals built from shell variables, because an empty variable widens the target to its parent. Never clean a whole repository. Finish everything a normal user can delete first, then put whatever needs an administrator into one reviewable batch, and check the result of the job itself, not only that authorization succeeded.\n5. **If free space falls again,** compare snapshots and find the writer. Temporary Git packs that keep coming back usually mean a background `git add` is ingesting generated files: follow [the Git procedure](references\/macos.md#git-temporary-pack-recurrence). Exclude only confirmed generated material, in that repository's own local exclude file rather than a shared `.gitignore`, back the file up first, and check that tracked files and useful new reports stay visible. Never copy another project's ignore patterns.\n6. **Verify and report** (below).\n\n## Safe to delete?\n\nWalk this for every candidate:\n\n```\nIs it inside what the person asked to clean, and not something they said to keep?\n\u251c\u2500\u2500 No \u2192 leave it. If it's large, list it as an opportunity.\n\u2514\u2500\u2500 Yes \u2192 Is anything using it: a process, an open file, a booted device, a running build or install?\n    \u251c\u2500\u2500 Yes, or a check failed \u2192 leave it, and say which check.\n    \u2514\u2500\u2500 No \u2192 What is it?\n        \u251c\u2500\u2500 A cache or download its tool rebuilds (package caches, test browsers, updater archives, build caches)\n        \u2502   \u2192 delete the stale part with the tool's own clean command or its exact path. Keep what the current\n        \u2502     version or a live worker needs.\n        \u251c\u2500\u2500 Generated project output (dependencies, builds, DerivedData)\n        \u2502   \u2192 only when its lockfile and build inputs stay and nothing tracked or hand-made is inside. Say it must\n        \u2502     be reinstalled before the project runs again.\n        \u251c\u2500\u2500 Something installed (an app, extension, runtime, simulator, emulator)\n        \u2502   \u2192 only when the request covers it and its row below passes. Try the vendor's or tool's uninstaller first.\n        \u251c\u2500\u2500 A duplicate (an installer, an APK or IPA, an archived profile)\n        \u2502   \u2192 only when a kept copy matches by version or hash and the current release stays.\n        \u2514\u2500\u2500 Something people made (source, media, research, chats, credentials, VM and container disks)\n            \u2192 never as cleanup. List it as a decision for the person.\n```\n\nOn top of being idle, each kind needs its evidence:\n\n| Candidate | Evidence it also needs |\n| --- | --- |\n| Dependencies and builds | It's known generated output; its lockfiles, build inputs or environment metadata stay; no tracked or custom file goes with it |\n| Installers, APKs, IPAs | It's obsolete or a duplicate; the current release, the builds reviewers use and any unique analysis evidence stay |\n| Emulators and simulators | It's a known throwaway test device with no current task or data on it. Being shut down isn't enough |\n| Git temporary packs | Git classifies it as garbage; its size and inode stay the same across separate checks; no live writer or open handle; history stays readable |\n| Model and package caches | Its contents download again; logins, installed environments, active models and persistent data stay |\n| Rarely used apps and extensions | Bundle or extension identity, measured size, current activity, and a recorded last use or an explicit \"unknown\"; the person's data and shared components stay |\n| Old or duplicate runtimes | Architecture, version, default choice, command links, dependent environments and runtimes embedded in apps are all checked. The pool's size isn't what's removable |\n| Downloads, history, logs | The person's own age and recent-use rules, real timestamps where the format has them, and no unique needed content or live writer |\n\n## Two examples\n\n**A cache that rebuilds.** `~\/Library\/Caches\/ms-playwright` is 2.4 GB and holds two Chromium builds. The project's lockfile pins the newer Playwright, and `ps -axo pid=,args=` shows nothing running from that folder. Delete the older build's exact folder, keep the newer one, and log that Playwright downloads the old one again if an old project asks for it. Then run `df` again: the change it shows is the result, not the folder's size on paper.\n\n**An old simulator runtime.** The person asked to remove simulators they haven't used in a month. `xcrun simctl list devices --json` shows four devices on iOS 18.2, none booted, each with a `lastBootedAt` from August, and no project's deployment target or test plan needs 18.2. Delete the four with `xcrun simctl delete <UDID>`, then the runtime with `xcrun simctl runtime delete <id>`. If the runtime only exists under `\/System\/Library\/AssetsV2` with the `restricted` flag, the tool can't remove it: point the person to Xcode Settings \u203a Components, or leave it and report it. Never turn off SIP.\n\n## Report\n\n- **Lead with free space now,** the measured change, and any space other jobs used up in the meantime.\n- **List what was removed:** path, size, reason, and what reinstalls it. Then what's unresolved, and the families or folders that weren't fully inspected.\n- **Then the opportunities that are left,** grouped as regenerable caches, optional installed software, and data that needs the person's decision. Each line has a stable number, the exact path or selector, the measured size of the part that's eligible, what it holds, the evidence of use, and the condition that would make it safe.\n- **Never inflate a total:** no parent and child counted twice, no \"all versions\" when one must stay, no empty device registrations, no virtual disk's maximum capacity, no personal files called cache. Folder sizes and deletion totals aren't recovered space: only `df` before and after is.\n- **If fewer real candidates remain than were asked for,** say so and name what wasn't inspected. Never pad the list.\n- **Check before claiming done:** removed paths are gone, kept active resources still work, lockfiles are unchanged and Git history still reads. After a runtime removal, check the environments that depended on it and the default executable. After an uninstall, check the app, its leftovers and its services. Name anything that must be reinstalled before reuse.\n\n## Tools\n\n- [The discovery checklist](references\/discovery.md) for broad audits.\n- [The macOS notes](references\/macos.md). Read the section for what you're about to touch before an app or runtime uninstall, an administrator batch, Git objects, devices and SDKs, or compression. They also cover use probes, APFS block sharing and the DeviceFS virtual view.\n- `<skill>\/scripts\/inventory.py` reads metadata only. It never decides what to delete and never removes anything. It skips symlinks and other filesystems, counts a hardlinked file once per root, and compares with an earlier snapshot.\n\n```bash\ncleanup_audit=\"$HOME\/Library\/Logs\/storage-cleanup\/$(date +%Y%m%d-%H%M%S)\"\numask 077\nmkdir -p \"$cleanup_audit\"\npython3 \"<skill>\/scripts\/inventory.py\" --root \"$HOME\/Developer\" --output \"$cleanup_audit\/inventory.json\"\n```\n\nAdd roots with more `--root` flags, compare with `--compare <earlier inventory.json>`, and see `--help` for the rest. `--max-depth` limits the summaries, not the walk, so scan one root at a time. A broad scan takes minutes: tell the person what's running and read the compact summary, never the whole file. A partial scan stays labeled partial.\n","use_cases":["Identify and delete unused caches and build outputs","Analyze disk usage to find large folders and their contents","Perform safe cleanup of old simulators and emulators","Generate reports on disk usage without deleting any files"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/LemonFace0309\/charles-skills\/blob\/e7c362148ff9936fcc905efab21733fb96a1f708\/skills\/qol\/charles-storage-cleanup\/SKILL.md","source_commit":"e7c362148ff9936fcc905efab21733fb96a1f708","license":null,"version":null,"listing_approved_at":"2026-11-30","created_at":"2026-11-29T11:15:15.000000Z","updated_at":"2026-11-30T06:52:46.000000Z","seo_title":"macOS Disk Cleanup Tool - Charles Storage Cleanup","seo_description":"Discover what's consuming disk space on your Mac and safely delete unused files with Charles Storage Cleanup. Analyzes caches, simulators, and build outputs with detailed","seo_keywords":["macOS disk cleanup","safe file deletion","storage analysis tool","unused file remover","disk space analyzer"]}}