WindowsmacOSLinux

Where Does Flutter Keep the Pub Cache and Build Files?

Flutter shares Dart's global pub cache plus per-project .dart_tool folders. Cache paths on Windows, macOS and Linux.

Last updated

Flutter dependencies resolve in two layers. Downloaded packages land in a global pub cache shared by every project on the machine. Each project then records its own resolution in .dart_tool/package_config.json, mapping imports to that shared store.

The global cache grows forever, so prune it with dart pub cache gc when disk runs low. Move it with the PUB_CACHE environment variable, handy for small system drives. Never copy .dart_tool between machines: rerun flutter pub get instead and let it regenerate.

Where Flutter stores this, by platform

Windows
%LOCALAPPDATA%\Pub\Cache

Global package store with hosted, git and binary subfolders. Per-project state sits in each project's .dart_tool directory. Override the global spot with PUB_CACHE.

macOS
~/.pub-cache

Same shared role as Windows. The SDK also keeps its own bin/cache under the Flutter install dir. Repair with flutter pub cache repair when packages look corrupt.

Linux
~/.pub-cache

Mirrors macOS exactly. Old Flutter versions pinned the cache inside the SDK at .pub_cache, so check PUB_CACHE if packages land somewhere unexpected.

Frequently asked questions

How do I clean the Flutter package cache?

Run dart pub cache gc to drop packages no project references anymore. For a single project, delete its .dart_tool folder and rerun flutter pub get. Full reinstalls of the cache start with flutter pub cache clean, then get.

Can I move the pub cache to another drive?

Yes. Set the PUB_CACHE environment variable to the new location before running any pub commands. Move existing contents over or just re-fetch. Point every machine's variable at the same convention to avoid confusion.

Notice an outdated path? Let us know.