Skip to content

The Hugging Face cache on Mac: where models go and how to clear them

The Hugging Face cache location on a Mac, what its hashed folders hold, why it keeps growing, and how to clear models, old revisions and downloads safely.

Local AI models · Published · 20 min read
Detailed view of computer hard disk drive components, showcasing circuitry and connectors.
Photo: Marta Branco on Pexels

The Hugging Face cache location on a Mac is ~/.cache/huggingface/hub, a hidden folder in your home folder. Every model and dataset that Transformers, Diffusers, Datasets, MLX, llama.cpp or Hugging Face's own command-line tool downloads lands there, in one folder per repository, and stays until you remove it.

To see it, open Finder, choose Go › Go to Folder, type ~/.cache/huggingface/hub and press Return. Folders are named after what they hold, such as models--mistralai--Mistral-7B-Instruct-v0.3, so you can tell which model is which.

To clear a model, quit the programs that use it and move its folder to the Trash. To clear everything, move the hub folder itself. Don't move the whole huggingface folder: it also holds your sign-in token.

The rest of this post explains the folders inside, why the cache keeps growing, why Finder sometimes shows a large model as a few kilobytes, and what clearing costs you.

Hugging Face cache location on a Mac

Hugging Face's libraries keep everything under one folder in your home folder, ~/.cache/huggingface. The models and datasets you download are in its hub folder; the rest is smaller and does other jobs.

Where is the cache by default?

Hugging Face's documentation gives ~/.cache/huggingface/hub as the default for models, datasets and Spaces. The folder starts with a dot, so Finder hides it until you go there directly with Go to Folder.

One cache serves every program on your Mac that uses Hugging Face's download code, so a model downloaded by one is ready for the next. That's also why clearing it affects all of them at once.

Why is it in .cache and not in Library?

Mac apps keep their caches in ~/Library/Caches, but Hugging Face's libraries come from the Python and Linux world, where caches go in a hidden .cache folder in the home folder. They use the same place on a Mac.

So the cache doesn't sit with the rest of your Mac's caches, and Finder doesn't show it in your home folder unless you go there directly. Many people only find it when a disk tool shows a large hidden folder in their home folder.

Can the cache be somewhere else?

Yes. Hugging Face's libraries read a few environment variables that move it. One moves the whole Hugging Face folder, another moves only the hub cache, and a general cache setting used on Linux applies when neither is set.

There's no settings window for any of them. If your hub folder is small or missing while your programs still find models offline, one of these settings is probably pointing elsewhere, set in a project's configuration or your shell's settings.

What else is in the huggingface folder?

Folder or fileWhat it holdsSafe to remove?
~/.cache/huggingface/hubModels, datasets and Spaces you downloadedYes; they download again
~/.cache/huggingface/xetData that speeds up uploadsYes; it's an optimization
~/.cache/huggingface/datasetsDatasets prepared by the Datasets libraryYes; it's rebuilt from the hub
~/.cache/huggingface/assetsFiles other libraries keep, such as processed dataUsually; check what made them
~/.cache/huggingface/tokenYour Hugging Face sign-inNo; removing it signs you out

The token is tiny but matters. Hugging Face's command-line tool saves your access token there, and a list of saved tokens in a stored_tokens file beside it, when you sign in. Gated models need it to download.

Which programs use the Hugging Face cache?

Hugging Face publishes a list of libraries and apps that share the layout. It includes its Python library and everything built on it, such as Transformers, Diffusers, Datasets, MLX and vLLM, plus its Swift, Rust and JavaScript libraries.

Apps that share it include llama.cpp, in its current versions, and Llama-macOS, a Mac app built on it. Older versions of llama.cpp kept downloads in their own folder, llama.cpp's model cache.

Not every AI tool shares it. LM Studio keeps its own copies in its own models folder, and Ollama stores models in its own format. The same model downloaded in each is stored again in each.

A well-organized warehouse shelving unit with numbered bins for efficient storage and inventory management.
The hub cache files every download under the repository it came from. Photo: cottonbro studio on Pexels

How the hub cache is organised

Open the hub folder and you'll see one folder per repository and a few small items. Inside each repository, the files have hashed names, which is what makes the cache look confusing in Finder.

What are the models-- and datasets-- folders?

Each folder name joins the repository's type, its owner and its name with double hyphens. A model from mistralai named Mistral-7B-Instruct-v0.3 becomes models--mistralai--Mistral-7B-Instruct-v0.3. Datasets start with datasets-- and Spaces with spaces--.

Removing one of these folders removes that repository from the cache and nothing else, with one exception covered below: files shared between repositories.

What are blobs, snapshots and refs?

Every repository folder has the same skeleton, which Hugging Face's documentation describes:

  • blobs holds the downloaded files themselves, each named by its hash.
  • snapshots has one folder per revision you've downloaded, filled with links named like the real files, such as config.json, pointing into blobs.
  • refs records which revision a branch, such as main, pointed to when you last downloaded it.
  • trees keeps the list of files in each revision, so a second download of the same revision needs no checking.

The links are what let one file serve several revisions. If a file didn't change between two revisions, it's stored once and linked from both.

What do the hashed names mean?

Each file in blobs is named by a hash of its content, so two identical files always get the same name. That's how the cache knows a file is already there and doesn't download it again.

It also means the names tell you nothing about what a file is. The snapshots folder is where the real names live, as links, which is why Finder shows config.json and model.safetensors there and long strings of letters in blobs.

A worked example

Hugging Face's documentation shows a small model, EsperBERTo-small, cached at two revisions. Its blobs folder holds one 321 MB weights file and two small README files, and each revision's snapshot links to the same weights file with its own README.

The weights are stored once, though two revisions use them. Removing the older revision would free only its README. Removing the whole repository folder frees everything, about 321 MB.

Why does the cache keep growing?

Because nothing is removed automatically. Hugging Face's documentation says cached files are never deleted: when a repository updates and you download the new revision, the previous files are kept in case you need them again.

So a model you've followed for a year can hold several revisions of its largest files. Add every model you tried once, every dataset from a tutorial, and every image model a library pulled in, and the folder grows quietly.

What is the shared blobs folder?

Newer versions of Hugging Face's library add a blobs folder at the top of the hub cache, next to the repository folders. Files downloaded through Hugging Face's Xet storage are kept there once, and each repository that uses one gets a link to it instead of its own copy.

It saves space when two repositories contain the same file. It also changes how deleting works, because a repository's own folder may now hold only links. The section on clearing the cache explains what that means in Finder.

What are the small items in the hub folder?

  • .locks holds lock files that stop two programs downloading the same file at once.
  • .no_exist, inside a repository, remembers optional files that weren't on the Hub, as empty files. Hugging Face describes its disk use as negligible.
  • CACHEDIR.TAG marks the folder as a cache, so some backup tools skip it.

None of them is worth removing for space.

How big the Hugging Face cache gets

It depends entirely on what you've downloaded. A small language model is under a gigabyte, while one quantized file of a large model can pass 15 GB. Hugging Face's own documentation uses a few real examples.

Examples from Hugging Face's cache documentation
  • t5-small model1 GB · Review first
  • bert-base-cased model1.9 GB · Review first
  • Llama 3.2 1B and Kokoro 82M together5.3 GB · Review first
  • One Gemma 3 27B GGUF file, Q4_K_M16.5 GB · Review first
  • Local model folders on a Mac, typical total20–150 GB · Review first

The first four are sizes Hugging Face's manage-cache guide shows in its examples. The last is the typical range for local model folders from the research behind the app's catalog; many Macs have far less.

How do you see how big it is?

In Finder, select the hub folder and choose File › Get Info. That total counts each stored file once, so it's the space you'd get back by clearing everything.

To see which repositories are largest, open the hub folder, choose View › as List, then View › Show View Options and select Calculate all sizes. For repositories downloaded the older way, the sizes are right. For ones using the shared blobs folder, read the next answer.

Why does Finder show a large model as a few kilobytes?

Because its files are in the shared blobs folder, and the repository's folder holds only links to them. Finder counts a link at its own tiny size, not the size of what it points to, so the repository looks almost empty while the model takes gigabytes.

Hugging Face's documentation notes the reverse effect in its own tool: sizes per repository are counted as if each had its own copy, while the total for the cache counts each shared file once. Neither is wrong; they answer different questions.

What does Hugging Face's own tool show?

Hugging Face's command-line tool, hf, has a cache list command that shows each repository with its size, when it was last used and last changed, and which branches point at it. It can filter by size and age, such as everything over 1 GB not used for 30 days.

It's the only view that shows when each model was last used. There's no window for it: the tool is used in Terminal, and Hugging Face has no Mac app for its cache.

The tool isn't on every Mac that has the cache. Hugging Face's documentation describes installing it with its Python library, with Homebrew or with its own installer, so a Mac that only runs one Python project may not have it at all.

Do datasets take space too?

Yes, sometimes more than models. A dataset's raw files sit in the hub folder like a model's, and the Datasets library keeps its own prepared copy in ~/.cache/huggingface/datasets. A large dataset you processed once can be stored twice.

How to clear the Hugging Face cache on a Mac

You have two routes: Finder, which works by repository or for the whole cache, and Hugging Face's own tool, which can also remove single revisions and files. Programs download whatever they need again, so nothing is lost but time.

Remove one model in Finder

  1. Quit any program or notebook that might be using the model.
  2. In Finder, choose Go › Go to Folder, type ~/.cache/huggingface/hub and press Return.
  3. Find the model's folder by its name, such as models--publisher--model.
  4. Move it to the Trash.
  5. Empty the Trash when you're sure you won't need it back.

That's all for repositories downloaded the older way. If the model's files were in the shared blobs folder, step 4 removed only links, and the data stays until you clear the whole hub folder or Hugging Face's prune command removes it.

To tell beforehand, open the repository's blobs folder. If its large files show the small arrow Finder uses for aliases, they're links, and the data is in the shared folder.

Clear the whole cache in Finder

If you're done with everything in it, move the hub folder itself to the Trash, with your Python programs and notebooks closed. That removes every model, dataset and Space, the shared blobs folder included, and nothing is left behind.

Leave the rest of ~/.cache/huggingface in place. Your token stays, so you're still signed in, and programs create a new, empty hub folder the next time they download.

What does Hugging Face's tool do differently?

It understands the cache's structure, so it can remove more precisely than Finder. Hugging Face documents four cache commands:

CommandWhat it removes
The list commandNothing; it shows repositories, revisions, sizes and last use
The remove commandWhole repositories, single revisions or single files, such as one GGUF file
The prune commandRevisions no branch or tag points to, unfinished downloads and unused shared files
The verify commandNothing; it checks cached files against the Hub

The remove command deletes a shared file only when no other repository still uses it, and both cleanup commands can show what they would do before doing it. Hugging Face's documentation calls the deletion permanent: nothing goes to the Trash.

Can you remove an old revision in Finder?

Not safely. A revision's folder in snapshots holds only links, so moving it to the Trash frees nothing. The space is in blobs, where files are named by hash and may belong to the revision you still use.

Removing old revisions is a job for Hugging Face's tool, which knows which blobs only old revisions need. In Finder, the safe unit is the whole repository folder.

Which repositories are worth removing first?

Start with the largest folders you don't recognize from current work. Image and video models downloaded by Diffusers are often several gigabytes each, and a tutorial can leave behind both a model and a dataset you never open again.

Then look for the same model in two forms. A repository of GGUF files for llama.cpp and the original repository for Transformers are separate downloads, and you rarely need both.

What if a program still has the model open?

A program that already loaded a model usually keeps working until it restarts, because the model is in memory. The next time it loads the model, it finds the files gone and downloads them again. Quit notebooks and servers before you clear the cache, so nothing downloads in the middle of your cleanup.

What about unfinished downloads?

When a download is interrupted, the partial file stays in a blobs folder with a name ending in .incomplete. Hugging Face's documentation notes that its list command only mentions them, and its prune command removes them.

In Finder, you can move .incomplete files to the Trash when no download is running. They're parts of files, so nothing uses them.

They're most common when a disk fills up mid-download. A download needs room for the whole file, so a 16 GB model needs about 16 GB free before it starts.

Can you clear only datasets?

Yes. Dataset repositories in the hub folder start with datasets--, so you can move just those to the Trash. Move the matching prepared copies in ~/.cache/huggingface/datasets too, or they keep their space.

Should you delete the shared blobs folder on its own?

No. Every repository that uses it links into it, so removing it leaves those links pointing at nothing, and programs have to download the files again. Remove the whole hub folder instead, or let Hugging Face's prune command clear only what no repository uses.

Hugging Face's documentation adds a warning for older tools: their cache cleanup may delete a shared file other repositories still need. It recommends an up-to-date version of its library for cleaning a cache that uses shared files.

Organized network server cables for efficient data management.
Models download in large pieces, and every revision you fetch stays until you remove it. Photo: panumas nikhomkhai on Pexels

What clearing the cache costs

Clearing the cache never touches your code, notebooks or fine-tuned models saved in your own folders. What it costs is downloads, and a few situations where a download isn't simple.

What you removeWhat happens nextWatch out for
A model's repository folderIt downloads again the next time a program loads itLarge models take a while
The whole hub folderEvery model and dataset downloads again as neededPrograms set to work offline fail until then
Old revisions, with Hugging Face's toolNothing, unless a program asks for that revisionProjects pinned to an old revision
The xet folderSome uploads transfer more dataAn interrupted upload starts over
The datasets folderDatasets are prepared again from the hub cacheSlow for large datasets
The tokenYou're signed outGated models stop downloading

Is there an undo?

Only for what you move in Finder. Folders you move to the Trash can come back with File › Put Back until you empty it, and they keep taking space until then. Hugging Face's tool deletes permanently, so check what it lists before you confirm.

What about gated models?

Some models, including many popular language models, are gated: you have to be signed in to Hugging Face and have accepted the model's terms on its page before it downloads. Clearing the cache keeps your sign-in, but if you've also signed out, sign in again before a program tries to download the model.

What about programs that run offline?

Hugging Face's libraries can be set to use only cached files and make no network calls. A program set up that way stops working when its model leaves the cache, until it's downloaded again with the network allowed. Check before clearing a cache on a Mac you use away from a connection.

Do you lose your own fine-tuned models?

Not from the cache. Models you train or fine-tune are saved wherever your code saves them, usually a folder in your project. Only models that came from the Hub are in the cache. If you uploaded your own model to the Hub, its cached copy downloads again like any other.

The Xet cache, datasets and other AI caches

Next to the hub folder are a few smaller caches, and a few more AI libraries keep folders of their own elsewhere in your home folder. Whisper speech models show both: mlx-whisper and faster-whisper use the hub cache, while OpenAI's own whisper package keeps a folder of its own.

How does Hugging Face's cache compare with other tools?

Each tool that downloads models keeps its own store, and only some of them share Hugging Face's.

ToolWhere its models liveHow to remove one
Transformers, Diffusers, MLX and others~/.cache/huggingface/hubIts repository folder, or Hugging Face's tool
llama.cpp, current versions~/.cache/huggingface/hubThe same as above
llama.cpp, older downloads~/Library/Caches/llama.cppMove the file to the Trash
LM Studio~/.lmstudio/modelsMy Models in LM Studio
Ollama~/.ollama/modelsOllama itself, never in Finder
PyTorch Hub~/.cache/torch/hubMove its folder to the Trash

What is the xet folder?

Hugging Face's newer storage system is called Xet, and its library keeps a cache for it in ~/.cache/huggingface/xet. According to Hugging Face's documentation, it now holds data for uploads only: a shard cache that helps skip data already on the Hub, and a staging area that lets interrupted uploads resume.

It's safe to remove. Its shard cache has a soft limit of 16 GB, shards expire after a few weeks, and Hugging Face's documentation says to remove the whole folder to reclaim its space. The folder named like https___cas_serv inside it is normal.

What does the Datasets library keep?

The Datasets library stores prepared copies of datasets in ~/.cache/huggingface/datasets, in its own Arrow format. The raw files it started from stay in the hub cache. Removing the datasets folder means each dataset is prepared again from those files the next time you load it.

What about PyTorch's own cache?

PyTorch Hub, and libraries built on it such as torchvision, keep downloaded models and pretrained weights in ~/.cache/torch/hub, separate from Hugging Face's cache. It's the same idea: everything stays until removed, and files download again when needed. The page on PyTorch Hub cache has the details.

Why do some Mac apps keep a separate copy?

Apps from the Mac App Store run in a sandbox, where the app's container acts as its home folder. An app that uses Hugging Face's libraries there keeps its cache inside its own container in ~/Library/Containers, not in your shared cache.

A developer on Apple's forums reported the effect: after clearing the shared cache, their app still had its model. Remove those models through the app's own settings, or by uninstalling the app, not by digging in its container.

Moving the cache to an external drive

Hugging Face's libraries don't have a settings window, so the cache moves only through the environment variables mentioned earlier. That's set where your programs run, which makes it a choice for each setup rather than a switch.

Is there a way to move it without settings?

Not a supported one. Replacing the folder with a link to another disk is common advice, but Hugging Face documents the environment variables as the way to choose a location, and every program has to see the same setting to share one cache.

If you'd rather not change settings, clearing models you don't use is the simpler fix. The cache only needs room for the models you're working with now.

Which drive format works?

One that supports symbolic links, such as APFS or Mac OS Extended. Hugging Face's documentation explains that the cache relies on links, and where they aren't supported it stores full copies in every snapshot folder, so a file shared between revisions is stored more than once.

Drives formatted as exFAT, the format many external drives ship with, may not support them. A cache that can't use links still works, but it takes more space for the same models.

What about other accounts on the Mac?

Each account has its own cache in its own home folder, so two people who download the same model store it twice. Clearing your cache doesn't touch theirs, and you can't see theirs from your account.

What happens when the drive isn't connected?

Programs pointed at it can't find their models, and depending on the setup they either stop with an error or start downloading again. Keep a drive you use for models connected while you work, and remember it if a model suddenly starts downloading.

Backups and keeping the cache in check

The hub cache is the opposite of what a backup is for: large, changing and easy to download again. Your own models and code are what to protect.

Does Time Machine back up the Hugging Face cache?

By default, yes. Hugging Face adds a CACHEDIR.TAG file to the cache, which its documentation says tells backup tools such as Borg, restic and rsync to skip the folder. Time Machine isn't on that list, and Apple doesn't document it reading the tag.

To leave the cache out, exclude it yourself:

  1. Choose Apple menu › System Settings, click General, then Time Machine.
  2. Click Options, then click the add button and choose the hub folder. You can also drag it into the list.
  3. Click Done.

The steps are the same in macOS 27 and macOS 26. Apple notes that excluded items still appear in Time Machine's local snapshots.

What should you back up instead?

Models you couldn't download again: a private repository you've since lost access to, or a model its author removed from the Hub. Copy those files somewhere outside the cache, and back up that copy. Everything public on the Hub stays available there for as long as its author keeps it.

A quick way to decide what to keep

In the cacheKeep it?
A model your current project loadsYes
Old revisions of a model you keep updatingRemove them with Hugging Face's tool
A model from a tutorial you finishedRemove its folder
A dataset you processed onceRemove it, and its copy in the datasets folder
Unfinished downloadsRemove them
Your tokenKeep it

Mistakes to avoid

  • Moving the whole huggingface folder to the Trash. It signs you out and removes your token along with the cache.
  • Deleting files inside blobs or snapshots. Hashed files can belong to the revision you still use; remove whole repositories instead.
  • Removing the shared blobs folder alone. Every repository that links into it breaks until its files download again.
  • Clearing a cache an offline setup depends on. Download what it needs again before you leave the network.
  • Assuming one cache covers every tool. LM Studio, Ollama and sandboxed apps keep their own copies.

How do you keep it from growing back?

Remove a model when you finish with it, not months later. Once a month, open the hub folder in list view with sizes calculated and look at the largest repositories. If you use Hugging Face's tool, its list of models not used for a month or more is a good starting point.

The guide to local AI models covers the other tools' folders. The posts on the LM Studio models folder and on deleting Ollama models cover the two biggest tools that don't share this cache.

How the app does it

Wombit explains Hugging Face's folders like everything else on the disk. Select one in the map, the app's home screen, and the inspector says what it is, which tools made it, and what removing it costs, from the catalog's entries. It reads only names, sizes and dates, and file names and paths never leave your Mac.

  • ~/.cache/huggingface/hub

    Hugging Face cache

    Models and datasets downloaded from Hugging Face, shared by every library and tool that uses them.

    Review first · Moves it to the Trash

  • ~/.cache/huggingface/xet

    Hugging Face Xet cache

    Caches that Hugging Face's Xet storage uses to avoid transferring the same data twice.

    Safe · Moves it to the Trash

  • ~/.cache/torch/hub

    PyTorch Hub cache

    Model code and pretrained weights downloaded by PyTorch Hub and libraries built on it, such as torchvision.

    Usually safe · Moves it to the Trash

  • ~/Library/Caches/llama.cpp

    llama.cpp model cache

    Model files llama.cpp downloaded from a web address or Docker Hub, and Hugging Face models saved by older versions.

    Usually safe · Moves it to the Trash

The hub cache is Review first: downloading models again can take a long time, so it never starts checked and never counts toward the safe-to-remove total. Checking it in Cleanup moves the whole hub folder, every model and dataset, to the Trash after the review sheet, where you can put it back.

The Xet cache is Safe, so it starts checked and counts toward the safe total. PyTorch's cache and llama.cpp's older cache are Usually safe: they come back, at the cost of a download.

To remove a single model or old revisions, use Finder or Hugging Face's own tool, as above. Seeing what the cache takes is free. Moving it to the Trash is PRO, one $4.99 payment with lifetime access. Every Pro tool's review is free to open, so you see what would go and why before you buy.

Frequently asked questions

Where does Hugging Face download models on a Mac?

To ~/.cache/huggingface/hub, in a folder per repository named like models--publisher--model. The folder is hidden, so use Go to Folder in Finder. Environment variables set for your programs can move it elsewhere.

Is it safe to delete the Hugging Face cache?

Yes. Everything in the hub folder can be downloaded again, and programs do it by themselves the next time they need a model. It costs time and bandwidth, and gated models need you to be signed in. Keep the token file next to the hub folder so you stay signed in.

Why is my Hugging Face cache so big?

Nothing in it is ever removed automatically. Every model and dataset you've downloaded stays, and when a model is updated, the files of earlier revisions are kept too. Datasets can also be stored twice: raw files in the hub folder and a prepared copy in the datasets folder.

How do I delete one model from the Hugging Face cache?

Quit programs that use it, then move its models--publisher--model folder in ~/.cache/huggingface/hub to the Trash. If the model used Hugging Face's shared blobs folder, its data stays there until you clear the whole hub folder or use Hugging Face's own tool to remove what no model uses.

Does deleting the cache delete my fine-tuned models?

No. Models you train or fine-tune are saved wherever your code saves them, usually in your project folder. The cache only holds files downloaded from the Hugging Face Hub, which can be downloaded again.

Do LM Studio and Ollama use the Hugging Face cache?

No. LM Studio keeps models in its own models folder, and Ollama stores them in its own format in its own folder. Tools built on Hugging Face's libraries, such as Transformers, Diffusers, MLX and current versions of llama.cpp, do share the cache.

Can I delete the xet folder in the Hugging Face cache?

Yes. It's a cache for Hugging Face's Xet storage that now speeds up uploads only, and Hugging Face's documentation says the whole folder can be removed to reclaim its space. At worst, a later upload sends more data or an interrupted upload starts over.

Sources

  1. Understand caching · Hugging Face
  2. Environment variables · Hugging Face
  3. Hub local cache · Hugging Face
  4. Cache management · Hugging Face Datasets
  5. Exclude files from a Time Machine backup on Mac · Apple