SiftMac
Is it safe to delete? · Package caches · Updated 21 November 2026

Is it safe to delete ~/.pub-cache?

By Mohit Nippanikar, who makes SiftMac

The short answer
On this page
  1. What’s in ~/.pub-cache
  2. Where it is
  3. How big it gets
  4. How to clear it
  5. What happens afterwards
  6. Questions

1. What’s in ~/.pub-cache

When a project runs pub get, pub downloads its dependencies into one system cache shared by every project, and each project refers to the packages there. Inside you’ll find:

The Flutter SDK keeps its own cache of engine and tool files inside the SDK folder, filled by flutter precache and Flutter itself. That one belongs to Flutter, not to pub, and isn’t part of this folder.

2. Where it is

~/.pub-cache

That’s $HOME/.pub-cache on macOS. Setting PUB_CACHE puts it somewhere else, for example on a bigger drive.

3. How big it gets

Every version of every package a project fetched stays, so it grows with the number of projects and upgrades over time rather than with what you use today:

du -sh ~/.pub-cache
du -sh ~/.pub-cache/hosted/*

4. How to clear it

  1. List your global tools so you can activate them again later.
  2. Stop running apps and IDE builds.
  3. Clear the cache. Pub asks first, warning that everything inside will go and that you’ll have to run pub get again in each project; --force skips the question.
dart pub global list
flutter pub cache clean

flutter pub cache clean and dart pub cache clean do the same thing, since flutter pub runs Dart’s pub. dart pub cache repair is different: it reinstalls every package in the cache and frees nothing.

Build folders in projects

Each Flutter project also has build and .dart_tool folders. flutter clean deletes both, and the next build makes them again:

cd ~/Projects/my_app
flutter clean

5. What happens afterwards

Questions

Can I delete ~/.pub-cache in Finder?

Yes, with nothing running; that’s what pub cache clean does for you. Dart’s docs say that with an SDK too old to have the clean command, you delete the PUB_CACHE folder by hand.

Will clearing the pub cache delete my Flutter SDK?

No. The SDK and its own cache live in the folder where you installed Flutter. Only downloaded packages and global tools go.

What does flutter clean delete?

Only the project’s build and .dart_tool folders. It leaves ~/.pub-cache alone, and the next build regenerates both.

Can I move the pub cache to an external drive?

Yes: set PUB_CACHE to the new folder in your shell profile, then run flutter pub get in each project so it refers to packages in the new place.

How SiftMac handles it. SiftMac doesn’t clear ~/.pub-cache. Under Developer files it lists build and .dart_tool folders next to a pubspec.yaml, in projects you haven’t changed for 1, 3 or 6 months, the same folders flutter clean removes, and it leaves the Flutter SDK’s own folders alone.

Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works