Flutter & Dart Cache Cleanup on Mac -- Free 10-30GB of Disk Space

A complete guide to finding and safely cleaning Flutter SDK caches, Dart pub packages, build artifacts, and emulator data on macOS

Published July 18, 2025 • 12 min read • by bysiber

Flutter is an amazing cross-platform framework, but it comes with a significant disk space cost. Between the Flutter SDK itself, Dart pub cache, platform build artifacts, and iOS simulator data, a typical Flutter developer's Mac can have 10-30GB or more consumed by Flutter-related files alone.

In this guide, we'll identify every Flutter and Dart cache directory on macOS, measure their sizes, and show you how to clean them safely -- without breaking your development environment.

Where Does Flutter Store Data on macOS?

Flutter and Dart scatter data across multiple locations. Here's the complete map:

DirectoryWhat It StoresTypical Size
~/development/flutter/Flutter SDK + engine artifacts2-8 GB
~/.pub-cache/Downloaded Dart/Flutter packages1-5 GB
~/.dartServer/Dart analysis server cache100-500 MB
~/.dart/Dart tool cache & analytics50-200 MB
~/.dart-tool/Dart tool configuration10-50 MB
build/ (per project)Compiled platform artifacts500 MB - 3 GB each
.dart_tool/ (per project)Package config & build cache50-200 MB each
ios/Pods/ (per project)iOS CocoaPods dependencies200 MB - 2 GB each
~/Library/Developer/CoreSimulator/iOS simulators (shared with Xcode)5-30 GB
~/.android/Android SDK/AVD data5-20 GB
⚠ Reality Check: A Flutter developer working on both iOS and Android targets can easily have 30-50GB consumed by Flutter-related caches and tools. On a 256GB MacBook, that's 12-20% of your total storage.

Step 1: Audit Your Flutter Disk Usage

Before cleaning anything, let's measure the damage:

# Flutter SDK size
du -sh $(which flutter | sed 's|/bin/flutter||')

# Pub cache size
du -sh ~/.pub-cache/

# Dart caches
du -sh ~/.dartServer/ ~/.dart/ ~/.dart-tool/ 2>/dev/null

# Find ALL build/ directories in Flutter projects
find ~/Projects -name "build" -path "*/android/*" -prune -o \
     -name "build" -type d -print 2>/dev/null | \
     while read d; do du -sh "$d" 2>/dev/null; done | sort -rh | head -20

# Find all .dart_tool directories
find ~/Projects -name ".dart_tool" -type d -exec du -sh {} + 2>/dev/null | sort -rh

# iOS Pods in Flutter projects
find ~/Projects -name "Pods" -path "*/ios/*" -exec du -sh {} + 2>/dev/null | sort -rh

# iOS simulators (shared with Xcode)
du -sh ~/Library/Developer/CoreSimulator/Devices/ 2>/dev/null

# Android AVDs
du -sh ~/.android/avd/ 2>/dev/null

Step 2: Clean Flutter Project Build Artifacts

The safest and most impactful cleanup starts with project-level build artifacts:

Clean a Single Project

# Inside your Flutter project directory:
flutter clean

# This removes:
# - build/ directory (compiled artifacts)
# - .dart_tool/ (package resolution cache)
# - ios/Pods/ (CocoaPods dependencies)
# - ios/.symlinks/
✓ Safe Operation: flutter clean is always safe. Everything it removes will be regenerated automatically on the next flutter pub get and flutter build.

Clean ALL Flutter Projects at Once

# Find and clean all Flutter projects
find ~ -name "pubspec.yaml" -maxdepth 5 -type f 2>/dev/null | while read f; do
    dir=$(dirname "$f")
    if [ -d "$dir/build" ] || [ -d "$dir/.dart_tool" ]; then
        echo "Cleaning: $dir"
        (cd "$dir" && flutter clean 2>/dev/null)
    fi
done

# Or just remove build directories directly (faster)
find ~/Projects -name "build" -type d -not -path "*/.*" | while read d; do
    size=$(du -sh "$d" 2>/dev/null | cut -f1)
    echo "Removing $d ($size)"
    rm -rf "$d"
done

Step 3: Clean the Dart Pub Cache

The ~/.pub-cache/ directory stores every version of every package you've ever used. Over time, it accumulates old versions that are no longer needed.

# Check pub cache size
du -sh ~/.pub-cache/

# See what's inside
du -sh ~/.pub-cache/hosted/
du -sh ~/.pub-cache/git/
du -sh ~/.pub-cache/bin/

# List cached packages
ls ~/.pub-cache/hosted/pub.dev/ | wc -l

# Clean and repair pub cache (removes and re-downloads)
flutter pub cache repair

# Nuclear option: wipe entire pub cache
flutter pub cache clean
# Or: rm -rf ~/.pub-cache/hosted/
ℹ Note: flutter pub cache repair re-downloads packages, so it won't save much space permanently. Use flutter pub cache clean to actually free space, then flutter pub get in your active projects to re-download only what you need.

Step 4: Clean Flutter SDK Artifacts

The Flutter SDK itself can grow over time as it downloads engine artifacts for different platforms and versions:

# Check SDK internal cache
du -sh $(flutter --version 2>/dev/null | head -1 | awk '{print $NF}')/bin/cache/ 2>/dev/null

# Or find it manually
du -sh ~/development/flutter/bin/cache/

# Breakdown of SDK cache
du -sh ~/development/flutter/bin/cache/artifacts/
du -sh ~/development/flutter/bin/cache/dart-sdk/
du -sh ~/development/flutter/bin/cache/downloads/

# Clean SDK cache (will re-download on next use)
flutter precache --all-platforms
# Or selectively:
flutter precache --ios --macos   # only platforms you need

# Remove artifacts for platforms you don't target
# (saves 1-3GB per platform)
rm -rf ~/development/flutter/bin/cache/artifacts/engine/android*
rm -rf ~/development/flutter/bin/cache/artifacts/engine/linux*
rm -rf ~/development/flutter/bin/cache/artifacts/engine/windows*
⚠ Be Careful: Removing platform artifacts means Flutter will need to re-download them if you later build for that platform. Only remove platforms you're sure you don't need.

Step 5: Clean Dart Analysis Server Cache

# The Dart analysis server accumulates cache data
du -sh ~/.dartServer/ 2>/dev/null

# Safe to delete -- regenerated automatically
rm -rf ~/.dartServer/

# Also check for Dart tool caches
du -sh ~/.dart/ 2>/dev/null
rm -rf ~/.dart/

Step 6: Clean iOS Simulator Data (Flutter iOS Development)

If you develop Flutter apps for iOS, simulator data is often the single largest cache item:

# Check simulator sizes
xcrun simctl list devices | grep -c "Booted\|Shutdown"
du -sh ~/Library/Developer/CoreSimulator/Devices/

# Delete unavailable/broken simulators
xcrun simctl delete unavailable

# List all simulators with sizes
xcrun simctl list devices -j | python3 -c "
import json, sys, os, subprocess
data = json.load(sys.stdin)
for runtime, devices in data.get('devices', {}).items():
    for d in devices:
        path = os.path.expanduser(f'~/Library/Developer/CoreSimulator/Devices/{d[\"udid\"]}')
        if os.path.exists(path):
            size = subprocess.getoutput(f'du -sh \"{path}\" 2>/dev/null').split('\t')[0]
            print(f'{size}\t{d[\"name\"]} ({d[\"state\"]})')
" 2>/dev/null | sort -rh | head -15

# Delete specific old simulators
xcrun simctl delete <UDID>

# Erase all simulator content (keeps simulators, removes app data)
xcrun simctl erase all

Step 7: Clean Android Build Caches (Flutter Android Development)

# Gradle caches from Android builds
du -sh ~/.gradle/caches/
du -sh ~/.gradle/wrapper/

# Android SDK caches
du -sh ~/.android/ 2>/dev/null
du -sh ~/Library/Android/sdk/ 2>/dev/null

# Clean Gradle build cache
cd your_flutter_project/android
./gradlew cleanBuildCache 2>/dev/null
./gradlew clean

# Clean Gradle caches older than 30 days
find ~/.gradle/caches/ -maxdepth 1 -type d -mtime +30 -exec rm -rf {} +

# Remove old Gradle wrapper versions
ls ~/.gradle/wrapper/dists/
# Keep only the latest version, remove others

Step 8: Clean CocoaPods Cache (Flutter iOS Dependencies)

Flutter iOS projects use CocoaPods, which maintains its own cache:

# Check CocoaPods cache
du -sh ~/Library/Caches/CocoaPods/

# Clean CocoaPods cache
pod cache clean --all

# Remove Pods directories from all Flutter projects
find ~/Projects -path "*/ios/Pods" -type d -exec rm -rf {} + 2>/dev/null

# After cleaning, regenerate in your project:
cd your_project/ios && pod install

The Complete Flutter Cleanup Script

Here's a comprehensive script that audits and optionally cleans everything:

#!/bin/bash
echo "=== Flutter & Dart Disk Usage Audit ==="
echo ""

# SDK
SDK_PATH=$(dirname $(dirname $(which flutter 2>/dev/null)) 2>/dev/null)
if [ -n "$SDK_PATH" ] && [ -d "$SDK_PATH" ]; then
    echo "Flutter SDK: $(du -sh "$SDK_PATH" 2>/dev/null | cut -f1)"
    echo "  SDK cache: $(du -sh "$SDK_PATH/bin/cache" 2>/dev/null | cut -f1)"
fi

# Pub cache
echo "Pub cache: $(du -sh ~/.pub-cache 2>/dev/null | cut -f1)"

# Dart caches
echo "Dart server: $(du -sh ~/.dartServer 2>/dev/null | cut -f1)"
echo "Dart config: $(du -sh ~/.dart 2>/dev/null | cut -f1)"

# Project build artifacts
TOTAL_BUILD=0
count=0
find ~/Projects -name "pubspec.yaml" -maxdepth 5 -type f 2>/dev/null | while read f; do
    dir=$(dirname "$f")
    if [ -d "$dir/build" ]; then
        size=$(du -sk "$dir/build" 2>/dev/null | cut -f1)
        count=$((count + 1))
        echo "  Build: $dir/build ($(du -sh "$dir/build" 2>/dev/null | cut -f1))"
    fi
done

# iOS Simulators
echo "iOS Simulators: $(du -sh ~/Library/Developer/CoreSimulator 2>/dev/null | cut -f1)"

# Android
echo "Android SDK: $(du -sh ~/Library/Android/sdk 2>/dev/null | cut -f1)"
echo "Android AVDs: $(du -sh ~/.android/avd 2>/dev/null | cut -f1)"

# Gradle (from Android builds)
echo "Gradle cache: $(du -sh ~/.gradle/caches 2>/dev/null | cut -f1)"

# CocoaPods
echo "CocoaPods cache: $(du -sh ~/Library/Caches/CocoaPods 2>/dev/null | cut -f1)"

echo ""
echo "=== Recommendations ==="
echo "1. Run 'flutter clean' in inactive projects"
echo "2. Run 'flutter pub cache clean' to clear package cache"
echo "3. Delete unused iOS simulators: xcrun simctl delete unavailable"
echo "4. Clean Gradle: find ~/.gradle/caches -mtime +30 -delete"
echo "5. Use ClearDisk for a visual overview: https://github.com/bysiber/cleardisk"

Skip the Manual Work -- Use ClearDisk

ClearDisk is a free, open-source macOS menu bar app that automatically finds and measures all your Flutter, Dart, pub cache, build artifacts, iOS simulators, and Android caches in one clean dashboard.

Download ClearDisk Free on GitHub

How Much Space Can You Recover?

ActionSpace RecoveredRisk Level
flutter clean on all projects2-15 GBNone -- safe
Clean pub cache1-5 GBLow -- re-downloads on demand
Delete unused simulators2-10 GBLow -- re-download available
Clean Gradle cache1-5 GBLow -- re-downloads on build
Remove unused SDK platform artifacts1-3 GBMedium -- re-download needed
Clean CocoaPods cache500 MB - 2 GBLow -- pod install restores
Delete Dart analysis cache100-500 MBNone -- auto-regenerated
✓ Total Potential Savings: A thorough Flutter cleanup can recover 10-30GB on a typical developer machine. Running flutter clean across all projects is the single highest-impact action.

Preventing Cache Bloat

Keep your Flutter disk usage under control going forward:

  1. Run flutter clean before committing -- build artifacts don't belong in git and don't need to persist
  2. Only precache platforms you use -- flutter precache --ios --macos instead of --all-platforms
  3. Delete old simulators regularly -- you probably don't need iOS 15 and 16 simulators anymore
  4. Use FVM (Flutter Version Management) -- manages SDK versions efficiently instead of multiple full installs
  5. Schedule monthly cleanups -- or use ClearDisk to monitor and stay on top of cache growth

Flutter Cache vs Other Developer Tools

How does Flutter compare to other tools for disk usage?

Developer ToolTypical Cache Size on macOS
Flutter + Dart (everything)10-30 GB
Xcode + DerivedData + Simulators15-50 GB
Docker Desktop10-30 GB
node_modules (across projects)5-20 GB
Homebrew2-8 GB
Rust (cargo + target/)5-25 GB
Go modules1-5 GB
Python (pip + virtualenvs)2-10 GB

Flutter sits in the upper tier of disk-hungry tools, primarily because of the iOS simulator and Android SDK requirements. If you're doing full cross-platform development (iOS, Android, macOS, web), the combined footprint is substantial.

Quick Reference: Essential Cleanup Commands

# Quick wins (safe, high impact)
flutter clean                          # Clean current project
flutter pub cache clean                # Clear package cache
xcrun simctl delete unavailable        # Remove broken simulators

# Medium impact
rm -rf ~/.dartServer/                  # Dart analysis cache
pod cache clean --all                  # CocoaPods cache

# Deep clean
find ~/Projects -name "build" -path "*/flutter*" -exec rm -rf {} +
find ~/.gradle/caches -mtime +30 -delete

# Audit
flutter doctor -v                      # Check Flutter health
du -sh ~/.pub-cache ~/Library/Developer/CoreSimulator ~/.gradle/caches

Automate Your Flutter Cache Monitoring

Stop manually running du commands. ClearDisk sits in your menu bar and shows you Flutter caches, pub packages, simulators, and every other developer cache -- all in one click.

Get ClearDisk -- Free & Open Source