Thinking global, living local

How to use cache_memory_cleaner: free Mac disk space without losing data

October 18, 2026

A macOS shell script that sorts any folder into five safety tiers before you delete it, and previews cache cleanup with a dry run.

Open-source tools · How-to · Mac storage

How to use cache_memory_cleaner: free Mac disk space without losing data

Skip to article content
Text Size

Revised · v1.0.0 · what changed

5data tiers, from never touch to delete now
4classify examples run in the demo
0files deleted in the demo (dry run only)
99%disk-full session the tool came from

Code: github.com/herrrickshaw/cache_memory_cleaner

Watch the walkthrough

Watch on YouTube: youtu.be/W_vkQopqFUg

What it is for

cache_memory_cleaner came out of a real session where a Mac disk was 99% full. Its rule is to remove only what can be rebuilt or is provably backed up.

The key command is classify. Give it a path and it reads git status, whether a running process has it open, whether it sits in a cloud-sync folder, whether the name looks like a personal scan, and how long since anything changed. It prints a tier and the reason. It never deletes anything.

Other commands act on the tier: clean-caches removes browser and package caches (with a dry-run mode), compress-local compresses files in place, and archive-evict uploads to your cloud, checks the bytes, and only then deletes the original.

Who it is for

  • Mac users with a nearly full disk who do not want to guess what is safe
  • Developers with old virtual environments, repos and VM folders
  • Anyone who wants a written reason before deleting something
Not for.
  • Windows or Linux: the script is for macOS
  • Automatic cleanup without reading the reasons. classify is a heuristic
  • Pointing archive-evict at a folder that another tool syncs (see limits)

What you need

RequirementWhyHow to get it
macOS with a shell (zsh or bash)the script uses macOS tools and pathsalready installed
gitto clone the repo and for the git checks in classifyxcode-select --install or brew install git
rclone (only for archive-evict)uploads archives to the cloud and verifies thembrew install rclone, then rclone config to set up your remotes
afsctool (only for compress-local)transparent compression. The README warns that ditto --hfsCompression silently does nothingbrew install afsctool
Not neededclassify and DRY_RUN clean-caches need no cloud account, no Python and no API keysnothing to set up

Get the code and an AI assistant

You do not have to be a programmer. Get the repository, give it to an AI assistant, and ask in plain language. Any of these routes works:

ToolWhat you needBest for
GitHubFree account to fork or star; git to clone, or the green Code button, then Download ZIP, or open in CodespacesGetting the code and keeping up with updates
Claude CodeClaude subscription or API key; run claude inside the cloned folderLetting the AI read and run the whole repo
Gemini CLIGoogle account; run gemini inside the cloned folderThe same hands-on workflow with Gemini
Claude.ai, Gemini or ChatGPT in the browserA chat account; upload README.md and the files you care about (or paste the output of git ls-files)Understanding the project and asking questions without installing anything
Other tools (Copilot Chat, Cursor, Codex CLI)Open the cloned folder in the tool and point it at README.md firstEditing and extending the code
git clone https://github.com/herrrickshaw/cache_memory_cleaner.git
cd cache_memory_cleaner
claude      # or: gemini

Install

  1. Clone the repo
    git clone https://github.com/herrrickshaw/cache_memory_cleaner.git
    cd cache_memory_cleaner
  2. Make the script executable
    chmod +x cache_memory_cleaner.sh
  3. Optional: install the helpers for the commands you plan to use
    brew install rclone afsctool

Quick start: commands and what you should see

Ask which tier a pure cache folder belongs to (read-only)

./cache_memory_cleaner.sh classify path/to/myproj/__pycache__

RECOMMENDATION: Tier 4, delete immediately, no backup needed, because the name matches a known cache pattern that regenerates.

Classify a Python virtual environment

./cache_memory_cleaner.sh classify path/to/venv

Tier 1, permanent local, compress in place. It can be rebuilt from requirements.txt, but until then something needs it as real files.

Classify a folder untouched for years

./cache_memory_cleaner.sh classify path/to/oldvm

In the demo, a folder dormant for 1,386 days and untracked came back as Tier 3: archive to the cloud, then evict. A git repo with a branch that has no upstream also got Tier 3 (git bundle). A path matching a personal scanned-document pattern got Tier 0, never touch.

Preview cache cleanup without deleting anything

DRY_RUN=1 ./cache_memory_cleaner.sh clean-caches

Lines starting [dry-run] rm -rf, covering browser caches, Chrome's on-device model caches, Chrome Service Worker and GPUCache folders, and pip caches. The demo ended with 'Free space: 21GB -> 21GB', since nothing was removed.

Ways to use it

MethodHow it works
Command line./cache_memory_cleaner.sh <command>. Commands in the README: report, clean-caches, clean-packages, find-dormant, git-gc, trim-vms, archive-evict, list-archives, compress-local, classify and all.
Dry runPut DRY_RUN=1 in front of any command to print what it would do.
Via an AI assistantAsk the assistant to run classify on a folder and explain the reason in plain language before you act.

Sample prompts for your AI assistant

Copy, paste and edit the parts in [brackets].

  • Read README.md and cache_memory_cleaner.sh and explain the five tiers in plain English.
  • Run classify on [path] and tell me what each check means and what the recommendation is.
  • I want to free about [20] GB. Run report, then suggest which folders to classify first. Do not delete anything.
  • Run DRY_RUN=1 clean-caches and explain each line it would remove and whether apps rebuild it.
  • Explain the risk if CLEANER_REMOTES points at a folder that another rclone sync job also writes to.
  • Help me set up rclone and a safe archive-evict destination, and confirm the destination is not synced by anything else.

Limits and honest caveats

  • classify is a heuristic. Read its reason, and the tier policy document in the repo-data-dedup repo, before acting on it.
  • Never point CLEANER_REMOTES at a path that another job mirrors with rclone sync. A sync job deletes remote files it does not find locally; in the author's case this wiped four verified archives.
  • compress-local needs afsctool. ditto --hfsCompression silently does nothing.
  • archive-evict needs rclone remotes already configured. It deletes originals, so it was not run in the demo.
  • The demo ran only classify (on example folders) and a dry run of clean-caches. It did not run report, find-dormant, trim-vms, archive-evict or compress-local.
  • The demo's classify paths were example folders, not a real system, and no files were deleted.

Sources: README.md and cache_memory_cleaner.sh in github.com/herrrickshaw/cache_memory_cleaner (MIT licence); demo run on 18 October 2026.

Revision history.
  • v1.0.0 — 18 October 2026 — first published.

About this article: Researched, written and edited by Umashankar Triplicane Dwarakanathan, with AI research assistance; every figure is meant to trace to the primary source cited. See the Editorial Policy for how sourcing, AI use and corrections work.

Umashankar Triplicane Dwarakanathan
Contact Us
Umashankar Triplicane Dwarakanathan
Investment Promotion & Energy-Sector Leader · Chennai, Tamil Nadu, India
LinkedIn → GitHub → Email +91 78273 81696
How this site works

Data-led analysis of India's trade, currency and industrial policy. Every article is built from primary official sources, and every figure links back to the release, table or filing it came from.

Sources. DGCI&S TradeStat (imports/exports, HSN-wise) · PIB (government press releases, January 2017 to today, refreshed daily) · RBI (circulars, balance of payments) · MoSPI (CPI/WPI, IIP) · PARIVESH (environmental clearances) · CCIL (bond yields) · BIS (policy rates) · SEBI, NSE/BSE and SEC filings for company data.

Interpretation. Figures carry their vintage and retrieval date; estimates and press-reported numbers are labelled as such; where sources disagree, both are shown. Corrections are made visibly, never silently. Articles are written with AI assistance from the cited sources — AI-generated text can misstate figures even when working from real material, so verify any number that matters to a decision against the linked primary source.

footer

Browse all articles by topic

Every piece on this blog, grouped. Or read the full index.

Agriculture & FertilisersAI ToolsChemicalsClimate & CarbonEnergy & FuelsGas & LNGImport SubstitutionIndustrial PolicyMarkets & FinanceMobility & EVPrices & InflationTextilesTrade & Tariffs

Each topic is a live archive page that updates itself as pieces are labelled. It replaces a hand-kept list that had fallen 18 articles behind.