DevCleaner
Menu
Skip to content
Browse guides

How to Clean Hugging Face and PyTorch Caches on Mac

Inspect downloaded models, preview a Hugging Face removal and distinguish regenerable PyTorch weights from your own checkpoints.

On this page

Models are downloads you may need again

A cache used for inference is not necessarily cheap to delete. Keep the models needed by offline work or private/gated repositories, and finish training, inference and downloads before making changes. Copy irreplaceable local checkpoints separately.

Find the active cache location

hf --version
hf cache --help
hf cache ls
du -sh "$HOME/.cache/huggingface" "$HOME/.cache/torch" 2>/dev/null

HF_HOME, HF_HUB_CACHE, XDG_CACHE_HOME and TORCH_HOME can change these locations. The directory returned by torch.hub.get_dir() is useful when PyTorch is installed in the environment you actually use:

python -c "import torch; print(torch.hub.get_dir())"

Preview one Hugging Face removal

Use an ID from your own cache listing. Current hf versions support repo-level dry runs; older versions may expose different command names, so check the installed help first. This example targets a public model repository only if it is already cached.

hf cache rm model/openai-community/gpt2 --dry-run
# Only after reviewing the dry run:
hf cache rm model/openai-community/gpt2

Inspect and confirm the target before proceeding. Shared blobs can serve more than one cached revision, so logical per-model sizes do not always add up to unique physical space. Prefer the cache command to manually deleting files inside hub snapshots or blobs.

PyTorch Hub weights are separate from your training outputs

Within the Hub directory, inspect checkpoints individually. Keep custom training outputs, optimizer state and experiment artifacts wherever your scripts save them; those are not automatically reproducible just because their filename ends in .pt or .pth. For a known re-downloadable checkpoint, stop readers and move that specific file to Trash. Do not remove an entire arbitrary TORCH_HOME tree.

How DevCleaner handles ML downloads

Hugging Face Cache and PyTorch Hub Cache are Warning categories, excluded from Quick Clean. Review the evidence before selecting them manually; this can remove more than one downloaded model. Keep account tokens and custom checkpoints outside the cleanup target. Deep cleanup requires Pro on new Free installations. Compare Ollama shared layers and supported scanners.

FAQ

Will deleting a model cache break offline inference?
It can: inference needs the removed weights again. Keep models required offline and verify that you can download gated/private models before cleanup.
Why did removing a model free less than its listed size?
Revisions and models can share physical data. The unique bytes removed can be smaller than their logical totals.

References and scope

Reviewed against DevCleaner 1.14.5 and the references below on October 4, 2026. Locations can change with tool versions and custom settings. The examples are inspection steps and deliberate cleanup actions, not a measured claim about how much space your Mac will recover.

Review the space before cleaning

DevCleaner separates built-in Safe caches from Warning and Danger items. Safe Quick Clean is free; deep cleanup requires Pro on new Free installations. See Free and Pro features.

Download DevCleaner ↓
macOS 14+ · Developer ID signed · notarized by Apple