> ## Documentation Index
> Fetch the complete documentation index at: https://aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Reclaim the disk Bazel never collects

> aspect gc removes Bazel output bases whose workspace is gone or that have sat idle, and prunes the download cache; aspect output-bases shows what's there first.

[← Shipped](https://aspect.build/shipped)

# Reclaim the disk Bazel never collects

***

![aspect gc removes orphaned and idle output bases and reclaims their disk](https://mintlify.s3.us-west-1.amazonaws.com/aspectbuild/images/marketing/illustrations/shipped-aspect-gc.svg)

Bazel keeps an output base for every workspace path it has built in, and every archive it has downloaded, forever. A coding agent that makes a git worktree per task makes an output base per task, tens of gigabytes each, and deleting the worktree leaves it behind.

[`aspect output-bases`](https://aspect.build/docs/cli/tasks/output_bases) shows what's there: every output base grouped by state, when it was last used, the memory its Bazel server holds, and the repository and branch it belongs to. [`aspect gc`](https://aspect.build/docs/cli/tasks/gc) removes what nothing is using.

```shell theme={null}
aspect output-bases --sort=size   # largest first, with sizes
aspect gc --dry-run               # what would go, deletes nothing
aspect gc                         # list, confirm, remove
```

## What gc removes

* **Orphaned output bases**, whose workspace directory is gone, an hour after last use (`--orphan-grace-hours`).
* **Idle output bases**, unused for 30 days (`--base-max-idle-days`).
* **Download cache entries** unused for 30 days (`--download-cache-max-idle-days`).

It keeps a base with a running Bazel server unless it's orphaned, and an [`aspect worktree`](https://aspect.build/docs/cli/worktrees) slot's base until it goes idle, since that base is what makes the slot's next lease warm. `--force` skips the prompt for cron and CI, and `aspect gc --all` clears every output base under the output user root.

It's in the Aspect CLI, free. [Reclaim disk and memory from Bazel](https://aspect.build/docs/cli/guides/reclaim-disk.md) covers tuning the rules and running it on a schedule.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.