Prune

Reference

Hugging Face cache location on Mac and Windows

Every from_pretrained call downloads into a hidden cache that never cleans itself. Ten to fifty GB is common after a few months of experiments. Here is where it is, how to move it, and how to trim it.

1. The default location

Each repo gets a folder such as models--org--name with blobs, snapshots and refs inside. Datasets use datasets-- folders.

2. HF_HOME and the other overrides

HF_HOME defaults to ~/.cache/huggingface, and the hub cache is HF_HOME/hub. HF_HUB_CACHE overrides the hub folder alone. Older code may still read TRANSFORMERS_CACHE. To move everything:

# Mac: add to ~/.zshrc
export HF_HOME=/Volumes/Data/hf

# Windows: then reopen your terminal
setx HF_HOME "D:\hf"

Existing downloads are not moved. Copy the old folder or let models download again. Tools that run in other environments, such as notebooks, containers or a second user account, each read their own variable, so set it where the code actually runs.

3. See what is cached, then delete

pip install -U "huggingface_hub[cli]"
huggingface-cli scan-cache
huggingface-cli delete-cache

delete-cache opens a list where you tick the repos or revisions to remove. Newer huggingface_hub releases also ship an hf command; run hf --help to see its cache options. You can also check sizes yourself:

# Mac
du -sh ~/.cache/huggingface/hub/* | sort -rh | head -20

# Windows (PowerShell)
Get-ChildItem "$env:USERPROFILE\.cache\huggingface\hub" | ForEach-Object {
  [pscustomobject]@{ GB = [math]::Round(((Get-ChildItem $_.FullName -Recurse -File | Measure-Object Length -Sum).Sum / 1GB), 1); Name = $_.Name }
} | Sort-Object GB -Descending

What is safe and what is not

Safe: anything in hub. The next load re-downloads what it needs. Not safe to remove by accident: the token file next to it, which keeps you logged in. On Windows without Developer Mode, the cache may hold full copies where Mac uses links, so it can run larger than you expect.

If you also run models in Ollama or LM Studio, you may hold the same weights twice. Keep one.

Or let Prune do it

Prune lists each cached Hugging Face model with its size and flags copies duplicated in Ollama or LM Studio. Your own files go to the Trash (Recycle Bin on Windows). The free scan shows every file before you pay. Pro is $15 a year or $29 once ($19 until 20 December 2026).

FAQ

What is the default Hugging Face cache location?

Models and datasets download to ~/.cache/huggingface/hub on Mac, and to C:\Users\<you>\.cache\huggingface\hub on Windows.

How do I change the Hugging Face cache directory?

Set HF_HOME to a new folder; the hub cache then lives in HF_HOME/hub. To move only the hub folder, set HF_HUB_CACHE. Existing files are not moved for you.

Is it safe to delete the Hugging Face cache?

The hub folder is safe: models download again on the next from_pretrained call. Keep the token file in ~/.cache/huggingface if you want to stay logged in.

Can Prune clean the Hugging Face cache?

Yes. Prune shows each cached model with its size, you pick what goes, and your files move to the Trash or Recycle Bin. It also flags weights duplicated in Ollama or LM Studio.

Related