Where is the Hugging Face cache on Mac, and how do you clear it?
Every model you load with transformers, diffusers, mlx-lm or hf download is cached so it doesn't download twice. On a Mac used for local AI, that cache often grows past 50 GB, and nothing ever removes old models on its own.
Default location
~/.cache/huggingface/hub
Each model or dataset gets its own folder, named like models--mlx-community--Llama-3.2-3B-Instruct-4bit or datasets--squad. Inside are three subfolders: blobs/ (the actual files), snapshots/ (one folder per downloaded revision, made of links into blobs) and refs/.
| Environment variable | Effect |
|---|---|
HF_HUB_CACHE | Sets the hub cache folder directly. |
HF_HOME | Moves everything Hugging Face stores; the cache becomes $HF_HOME/hub. |
If you set either one in your shell profile, the cache is wherever it points, and that's also where tools will look for models.
See what's using space
The current Hugging Face CLI is hf (from huggingface_hub; install with pip install -U huggingface_hub). List cached models, biggest first, or least recently used first:
hf cache ls --sort size
hf cache ls --sort accessed:asc
Older guides mention huggingface-cli scan-cache and delete-cache. Those commands were replaced by hf cache in recent versions of huggingface_hub.
Delete models you no longer use
# Preview first
hf cache rm model/black-forest-labs/FLUX.1-dev --dry-run
# Then delete
hf cache rm model/black-forest-labs/FLUX.1-dev
Use the repo ID shown by hf cache ls, prefixed with model/ or dataset/. You can pass several at once.
Two more useful commands:
# Remove old revisions and half-finished downloads, keep current models
hf cache prune --dry-run
hf cache prune
prune is the safe first step: when a model is updated, the old revision's files stay on disk until you prune them.
You can also move a whole models--… folder to the Trash in Finder. It's re-downloaded the next time something loads that model.
Deleting a model while a script or notebook is loading it can make that job fail. Stop running jobs first.
Move the cache to an external drive
If you want to keep a big collection, point the cache at an external SSD by adding this to ~/.zshrc, then restart your terminal:
export HF_HOME="/Volumes/AI/huggingface"
Move the existing ~/.cache/huggingface contents there first, or models will simply download again. Loading from a fast USB or Thunderbolt SSD is fine; the model is read into memory once.
Rather see it all at once? Storage Cleaner finds every cached Hugging Face model and dataset, along with Ollama and LM Studio models, in one scan, shows when you last used each item and whether it's safe to remove, and cleans to the Trash with Undo. Free to scan; one payment of $2.99 to clean, yours for life.
Download freeFrequently asked
Does MLX use the same cache? Yes. mlx-lm and other MLX tools download through the Hugging Face hub, so their models live in the same folder.
What about LM Studio and Ollama? Each keeps its own copies: LM Studio in ~/.lmstudio/models (guide) and Ollama in ~/.ollama/models (guide). The same model downloaded in all three takes three times the space.
Is it safe to delete the whole hub folder? Yes; it only contains downloads. Everything you use again will be re-downloaded, which for big models can mean tens of gigabytes of downloads.