Skip to main content

purger

purger finds the caches that developer tools leave on your disk, shows how much space each cache uses, and removes the caches that you approve. It uses the cleanup command of each tool when the tool has one. It deletes a cache directory by hand only when no command exists, and only inside your home directory.

Without --dangerous and your explicit confirmation, purger never deletes your files, your projects, or data that cannot be rebuilt.

What purger cleans

purger runs on macOS and Linux. Each supported tool is a plugin, and each plugin has one or more cleanup actions.

  • ansible (macOS, Linux): temp folders left by interrupted runs and the Galaxy cache, in ~/.ansible and $ANSIBLE_HOME. Skipped while an ansible command runs.
  • apt (Linux): downloaded package files. Both actions run with sudo.
  • brew (macOS, Linux): old formula versions, the download cache, and dependencies that nothing needs anymore.
  • bun (macOS, Linux): packages unused for 30 days, or the entire cache with --dangerous.
  • cocoapods (macOS): the pod download cache.
  • conda (macOS, Linux): downloaded package tarballs, packages that no environment uses, the index cache, and logs.
  • corepack (macOS, Linux): downloaded yarn, pnpm, and npm versions.
  • dnf (Linux): downloaded package files. Runs with sudo.
  • docker (macOS, Linux): the build cache, unused images, stopped containers, unused networks, and unused volumes.
  • flatpak (Linux): runtimes and extensions that no app uses, in your user installation and, with sudo, the system installation.
  • go (macOS, Linux): the build cache and the module download cache.
  • macports (macOS): build files, source archives, and inactive ports. Both actions run with sudo.
  • maestro (macOS, Linux): logs, screenshots, and local recordings of past maestro test runs. Skipped while Maestro runs.
  • mise (macOS, Linux): stale cache files and unused tool versions, or the entire cache with --dangerous.
  • npm (macOS, Linux): unneeded cache data and the npx cache, or the entire cache with --dangerous.
  • pacman (Linux): cached package versions beyond the newest 3, and every cached version of uninstalled packages. Needs paccache from pacman-contrib, and runs with sudo.
  • pip (macOS, Linux): the download and wheel cache, even when pip is no longer installed.
  • playwright (macOS, Linux): browser builds older than the newest of each browser.
  • pnpm (macOS, Linux): store packages that no project uses, and registry metadata in formats the installed pnpm can no longer read.
  • podman (macOS, Linux): unused images, stopped containers, pods, networks, and build cache, and unused volumes with --dangerous.
  • pre-commit (macOS, Linux): unused hook repos, or the entire cache with --dangerous.
  • prek (macOS, Linux): unused hook environments, or the entire cache with --dangerous.
  • rip2 (macOS, Linux): the rip2 graveyard of deleted files. Runs only when rip on PATH is rip2.
  • simulators (macOS): simulator devices the installed Xcode cannot run.
  • swiftpm (macOS, Linux): cached package clones, manifests, and binary frameworks.
  • thumbnails (Linux): the desktop file thumbnail cache.
  • trash (macOS, Linux): everything in the Trash in your home folder. On macOS, the terminal needs Full Disk Access.
  • uv (macOS, Linux): unused cache entries, or the entire cache with --dangerous.
  • xcode (macOS): build products, device debug symbols, and app archives.
  • yarn (macOS, Linux): the global package cache, even when yarn is no longer installed.

purger skips a plugin when its tool is not installed, is not running, or does not apply to your platform. Run purger clean --dry-run to see the actions that would run, with their risk tiers.

Install

purger needs Python 3.13 or later.

To install purger with uv, run this command:

uv tool install purger

To install purger with pip, run this command:

pip install purger

Run purger as your normal user. purger refuses to run as root. It asks for sudo only for the actions that need it, such as the apt and macports actions.

Quick start

Start with purger info. It measures each cache and prints a table with one row for each tool: the size of its cache and a short description. A check in the Partial purge column means that a clean removes only part of that size. purger info deletes nothing.

purger info

Then run purger clean. It prints the same table, asks for confirmation, and runs the cleanups that you approve. At the end, it prints a table with the size of each cache before and after the clean, and the space that was freed.

purger clean

Commands

Both commands accept plugin names as arguments. Without names, a command uses every plugin.

purger info uv brew              # measure only the uv and Homebrew caches
purger clean xcode --dry-run     # show what would be cleaned, change nothing
purger clean docker --dangerous  # also offer to remove unused Docker volumes

These options apply to both commands:

Option Effect
--dangerous Include dangerous actions. Without it, purger hides them.
--json Print exactly one JSON document on stdout instead of tables and messages.
-v, -vv Show more detail, such as the output of the tool commands.

These options apply to purger clean only:

Option Effect
--dry-run List the commands and paths that would run. purger asks nothing and changes nothing.
--yes, -y Skip the single prompt for safe actions.

Risk tiers

Each cleanup action has one tier. The tier controls how purger asks for confirmation.

Tier Meaning Confirmation
safe The tool rebuilds the cache cheaply and automatically. One prompt for all safe actions.
caution The cache can be rebuilt, but the rebuild is slow or a large download. One prompt for each action.
dangerous The action can destroy data that cannot be recreated, or it removes a complete cache. Shown only with --dangerous. One prompt each.

The --yes flag skips only the prompt for safe actions. A caution or dangerous action never runs unless a person answers its prompt.

Warning: Docker volumes is a dangerous action. It deletes every volume that no container uses, which includes the data of local databases.

Use purger in scripts and agents

Add --json to a command to get exactly one JSON document on stdout. Every document has "schema_version": 1, and every size is an integer number of bytes.

purger info --json
purger clean --json --yes

purger clean --json never prompts. With --yes, it runs the safe actions only. It reports each caution and dangerous action as declined. Without a terminal, purger applies the same rules.

The help pages give the full document shape and the status values:

purger info --help
purger clean --help

Exit codes

Both commands use these exit codes:

Code Meaning
0 Success. This includes a run where you declined every action.
1 An action that you approved failed. Only purger clean uses this code.
2 A usage error, such as an unknown plugin name or a run as root.
130 You pressed Ctrl-C.

Contributing

To build purger, run the tests, or add a plugin, read CONTRIBUTING.md.

License

purger is available under the MIT License.

Metadata

Release files for purger 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for purger 0.2.0
File Size Uploaded Provenance Actions
purger-0.2.0.tar.gz 49.5 kB Without provenance Details for purger-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for purger 0.2.0
File Interpreter ABI Platform Actions
purger-0.2.0-py3-none-any.whl Python 3 none any Details for purger-0.2.0-py3-none-any.whl

Total release size: 116.1 kB

Release files / purger-0.2.0.tar.gz

Download URL purger-0.2.0.tar.gz
Size 49.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c1d7f514306f23fa95b1420e75fc4c0fa889b000b9120e9686c7d453b023663f
BLAKE2b-256 checksum
How to use checksums
ac18db093cd0e40b3589d560a4a75d315d4e65951408dfcf41708d15b55e85be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / purger-0.2.0-py3-none-any.whl

Download URL purger-0.2.0-py3-none-any.whl
Size 66.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9dd265fba1e13a95da0b125ac8fb2d391f033865dde85bd54f5cd07ba409a3a
BLAKE2b-256 checksum
How to use checksums
a6a221002acb0c110d073c621af7b2347d398079d7fdc8ab5e492b2c5b0e6f79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for purger 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page