misonoteApp Center

Flutter/Dart ~/.pub-cache taking up space: safe to delete?

Check before deletingMay still be useful; Thermo moves it to the Trash by default, so you can change your mind.

Where it is

  • ~/.pub-cache/hosted

What it is

Dart's pub tool, which Flutter uses for dependencies, downloads packages from pub.dev into a shared system cache. The hosted folder contains one unpacked directory per package version, and projects reference these directories directly instead of copying them.

Why it gets so big

Every version of every package any project has used stays here, and Flutter plugins often carry native platform code for several platforms. It isn't pruned automatically.

Is it safe to delete?

Yes, with a step afterwards, which is why it's flagged for review. Because projects point straight at these folders, they won't build until you run pub get (or flutter pub get) to download their packages again. Globally activated Dart tools that depend on hosted packages may also need to be reactivated.

Tip

Dart's own pub cache clean command goes further than this cleanup and empties the entire ~/.pub-cache, including git dependencies and global tools.

See how much space it uses

du -sh "$HOME/.pub-cache/hosted" 2>/dev/null

Clean it with the tool’s own command

dart pub cache clean

Delete it by hand

Run in Terminal. Deleting cannot be undone, so check the paths first.

rm -rf "$HOME/.pub-cache/hosted"/*