Where Hugging Face stores models on a Mac, and how to clear them
Hugging Face libraries store downloaded models and datasets in ~/.cache/huggingface/hub, one folder per repository, unless HF_HOME or HF_HUB_CACHE points elsewhere. List them with hf cache ls and remove one with hf cache rm, using --dry-run first. Deleted models download again the next time a script asks for them.
Why it gets big
When transformers, diffusers or any other library loads a model with from_pretrained, it downloads the files from the Hugging Face Hub and keeps them in a shared cache so the next run starts at once. Model weights are large. Try a few language or image models and the cache can reach tens of gigabytes.
The cache never expires. It also keeps more than one revision of a model if the repository changed between downloads. And because it lives in a hidden folder, ~/.cache, it does not show up in Finder.
Inside the hub folder, each repository gets its own folder:
models--org--name,datasets--org--nameorspaces--org--nameblobsinside it holds the real files;snapshotsholds links to them, one folder per revision.
Recent versions of huggingface_hub also keep a xet folder next to hub.
How to clear it by hand
1. Check where your cache is
echo $HF_HOME $HF_HUB_CACHE
du -sh ~/.cache/huggingface/hub/* | sort -hIf both variables are empty, the default ~/.cache/huggingface/hub is the one in use. If you set either one, look there instead.
2. List what is cached
The hf command comes with the huggingface_hub Python package (pip install -U huggingface_hub).
hf cache lsIt shows each cached model and dataset with its size and when it was last used.
3. Remove a model, previewing first
hf cache rm model/openai-community/gpt2 --dry-run
hf cache rm model/openai-community/gpt2Use the names from hf cache ls. To remove everything you have not touched in a year:
hf cache ls --filter "accessed>1y" -q
hf cache rm $(hf cache ls --filter "accessed>1y" -q) --dry-runDrop --dry-run when the list looks right.
4. Clear old revisions and broken downloads
hf cache prune --dry-run
hf cache pruneThis removes revisions no branch points at any more and downloads that never finished, and keeps the current version of every model.
On an older huggingface_hub, the same jobs were done by huggingface-cli scan-cache and huggingface-cli delete-cache. Updating the package gets you the hf commands.
- Safe: removing any cached model or dataset. The cost is downloading it again.
- Delete whole folders, not parts: if you use Finder, remove an entire
models--…folder. Deleting only a snapshot leaves the blobs, and the space, behind. - Gated models: some need you to be logged in to download again. Check before removing one you cannot easily get back.
Ollama and LM Studio keep their own copies of models elsewhere; see deleting Ollama models.
How Berth handles it
Berth looks at the default cache, ~/.cache/huggingface/hub, and the xet folder next to it. It names the models and datasets it finds (models--org--name becomes org/name), counts them, and tells you how many were downloaded more than 60 days ago.
- Re-downloadable: the Hugging Face cache, with the download size shown so you know what getting it back costs.
- Re-downloadable: PyTorch and Keras downloads in
~/.cache/torchand~/.keras/models. - Your call: LM Studio models.
Be clear on the limits. Berth treats the cache as one finding: cleaning it moves the whole hub cache to the Trash, not single models. To keep some models and drop others, use hf cache rm as above. Berth does not look for a cache you moved with HF_HOME or HF_HUB_CACHE.
The cache is counted as local AI models when Berth splits up System Data.
Whatever Berth finds goes into a review tray first. A dry run shows exactly what would move, pre-flight checks make sure the owning app is closed, and everything goes to the macOS Trash, so Undo puts it back. Berth is free to scan and explore; one-click cleanup is part of Berth Pro, $14.99 one-time for 2 Macs. There is no account and nothing is uploaded.
Questions
Where does Hugging Face store models on a Mac?
In ~/.cache/huggingface/hub by default, one folder per repository. Setting HF_HOME or HF_HUB_CACHE moves it.
Is it safe to delete the Hugging Face cache?
Yes. It only holds downloaded copies. The next script that needs a model downloads it again, which can take a while for large models.
How do I delete one Hugging Face model?
Run hf cache ls to find its name, then hf cache rm with that name. Add --dry-run first to see what would be deleted.
How do I move the Hugging Face cache to an external drive?
Set HF_HOME to a folder on the drive, for example in your shell profile. New downloads go there. Move or delete the old cache yourself.
