Flutter Stole 48GB from My MacBook (And How I Got It Back)
August 12, 20257 min read
Flutter Stole 48GB from My MacBook (And How I Got It Back)
My journey from “disk almost full” to reclaiming nearly 50GB of storage
๐จ The Wake-Up Call
It was 2 PM on a Tuesday when VSCode delivered the dreaded notification: “Your startup disk is almost full.” My MacBook, usually reliable, was gasping for air. If you’re a Flutter developer, this story probably sounds familiar. But how did it happen? I’m not a video editor or someone working with massive datasets. Where could all that space have gone?
The answer would shock me: Flutter and Dart had quietly consumed 48GB of my precious SSD space.
Note: Unfortunately, I didn’t capture the initial “disk almost full” warning since I wrote this blog post after solving the crisis. But trust me, the panic was real! ๐
The Investigation Begins
Like any good developer facing a crisis, I opened Terminal and started digging. What I discovered was both embarrassing and enlightening:
21 Flutter versions via FVM (~28GB)
17 Dart versions via DVM (~8.6GB)
Dozens of build/ folders across projects (~8GB)
Abandoned Git repositories collecting digital dust (~5GB)
“But I need all these versions for testing!” - that’s what I told myself. Spoiler alert: I absolutely didn’t.
๐ When Flutter Becomes Greedy
The Silent Storage Killer
Here’s the thing about being a passionate Flutter developer: we experiment, we test, we clone repositories, and we install “just one more version” for that specific project. Each action seems harmless:
Install Flutter 3.32.6 for the latest features? Just 1.2GB.
Keep that old 3.16.0 for a legacy project? What’s another 1.1GB?
Don’t clean build/ folders because “I might need them”? They’re only 200MB each…
Multiply this by months of development, and suddenly you’re looking at a storage disaster.
The Moment of Truth
When I ran my first storage audit, the numbers were staggering:
Over 40GB just for version managers and the pub cache. That’s like carrying around 10+ HD movies on your development machine for no reason.
๐งน Phase 1: The Great build/ Folder Purge
Every time you run flutter build, a build/ directory appears. These folders can range from 100MB to over 1GB each. Now multiply that by every Flutter project you’ve ever touched.
The Automated Solution
Rather than manually hunting them down, I created a script to find and list all Flutter-related build folders.
#!/bin/bash
# Find all directories named "build"find . -type d -name "build" -exec sh -c '
# Get the parent directory of the build folder
parent_dir=$(dirname "$1")
# Check if a pubspec.yaml exists to confirm it is a Flutter project
if [ -f "$parent_dir/pubspec.yaml" ]; then
# If it is, calculate its size and print it
size=$(du -sh "$1" | cut -f1)
echo "$size - $1"
fi
' sh {}\;
Result: 42 build folders found, 8GB reclaimed with a single command!
๐ฏ Phase 2: FVM Version Management Reality Check
The Shocking Inventory
$ fvm list
Cache Directory: /Users/boris-wilfriednyasse/fvm/versions
master
stable
beta
3.32.6
3.32.4
3.29.0 (global)3.27.0
3.24.4
3.24.0
# ... 15 more versions
21 Flutter versions! Each taking 1-1.5GB. When did I become a Flutter version hoarder?
FVM analysis showing 21 installed Flutter versions with cleanup strategy ( content in French)
The Conservation Strategy
Instead of nuking everything, I developed a clear retention policy:
Keep:
Release channels (master, stable, beta) for testing edge cases.
The latest 3 stable versions for current projects.
Remove:
Everything else.
The Automated Cleanup Script
#!/bin/bash
# Define a list of essential versions to keep.KEEP_VERSIONS=("master""stable""beta""3.32.6""3.32.4""3.29.0")# A function to check if a version is in our keep list.should_keep_version(){ local version="$1"for keep in "${KEEP_VERSIONS[@]}"; doif["$version"="$keep"]; thenreturn0# 0 means "true" in bash, so we keep it.fidonereturn1# 1 means "false", marking it for removal.}# The script then loops through installed versions,# checks against this function, and asks for confirmation before deleting.
Result:28GB reclaimed by removing 15 unnecessary Flutter versions!
FVM cleanup results showing 15 versions removed and 28GB reclaimed(content in French)
๐ฏ Phase 3: DVM Dart Version Minimalism
The Location Mystery
First challenge: where does DVM actually store Dart versions? The documentation wasn’t crystal clear.
After some detective work, I found them hiding in ~/.dvm/darts/:
DVM analysis showing 17 Dart versions with sizes and cleanup strategy(content in french)
The Minimalist Approach
For Dart, I went nuclear with a simple rule:
Keep: Only version 3.8.3 (the latest stable I needed).
Remove: Everything else.
Why? Unlike Flutter, I rarely need multiple Dart SDKs for compatibility testing. The latest stable version handles 99% of my use cases.
#!/bin/bash
KEEP_VERSIONS=("3.8.3")# Clean everything except the latest
Result:8.6GB reclaimed!
DVM cleanup completion showing 16 versions removed and 8.6GB reclaimed(content in french)
๐ Phase 4: Git Repository Archaeology
The Forgotten Projects
In my github/ and gitlab/ directories, dozens of repositories were gathering digital dust. But which ones were still relevant?
A Note for macOS & Linux Users: The project analysis script is designed for a Unix-like environment. It works out-of-the-box on macOS. On Linux, the date command might need a slight adjustment (e.g., using date -d "6 months ago"). For best results on macOS, you can install coreutils with brew install coreutils to get access to gdate.
The Activity Analysis Script
This script identifies projects that haven’t been touched in over six months.
#!/bin/bash
# A function to get the date of the last commit.get_last_activity(){ local project_dir="$1"if[ -d "$project_dir/.git"]; then cd "$project_dir"# Log the last commit date in a simple format (YYYY-MM-DD) git log -1 --format="%ci" 2>/dev/null | cut -d' ' -f1
cd - >/dev/null
fi}# Define the date for 6 months ago.six_months_ago=$(date -v-6m +%Y-%m-%d)# The script then compares each project's last activity to this date.
Result: Additional 5GB reclaimed by archiving or deleting old projects.
๐ Mission Accomplished: 48GB Recovered!
Category
Space Reclaimed
Action Taken
build/ folders
~8GB
Complete removal
Flutter versions (FVM)
~28GB
Selective retention
Dart versions (DVM)
~8.6GB
Minimal retention
Obsolete projects
~5GB
Archive or deletion
TOTAL
~48GB
๐ฏ Success!
๐ The Toolkit: Scripts That Saved My SSD
All scripts are available on my GitHub repository with detailed documentation.
Core Scripts
flutter_build_cleaner.sh: Build folder cleanup.
fvm_cleaner.sh: Flutter version management.
dvm_cleaner.sh: Dart version management.
project_analyzer.sh: Git repository analysis.
๐ From Digital Hoarding to Intentional Development
This cleanup taught me more than just storage management. It was a lesson in resourcefulness.
The Psychology of “Just in Case”
As passionate developers, we accumulate resources:
“This version might be useful later.”
“This test project isn’t that big.”
“I’ll clean up when I have time.”
Reality check: Storage is a finite, valuable resource. A clean environment improves performance, simplifies maintenance, and reduces cognitive overhead. An intentional approach to our tools is as important as an intentional approach to our code.
Proactive Build Cleanup: Add an alias to your shell profile (.zshrc, .bash_profile).
alias flutter-clean-all="find . -name 'build' -type d -exec rm -rf {} + 2>/dev/null"
Strategic Version Management:
FVM: Keep a max of 5-6 versions (channels + 2-3 recent stable).
DVM: Keep a max of 2-3 Dart versions.
Monthly Audits: Schedule a recurring 15-minute calendar event to review old projects and SDKs.
๐ก Your Turn: The 5-Minute Storage Audit
I challenge you to run these two commands right now:
# 1. How much space are your SDKs using?du -sh ~/fvm/versions ~/.dvm
# 2. How many build folders are hiding in your current directory?find . -name "build" -type d | wc -l
Tweet me @bwnyasse with your results using the hashtag #FlutterCleanup! Let’s see who can reclaim the most space.
Twitter: Share your cleanup wins with #FlutterCleanup.
LinkedIn: Connect and share your storage optimization stories.
Remember: 48GB recovered in one afternoon with reusable scripts. Your SSD (and your sanity) will thank you.
Happy coding with a cleaner environment! ๐งนโจ
A huge thank you to the Flutter and Dart communities for the continuous inspiration. As a Flutter GDE, it’s incredibly rewarding to share practical solutions that make our development lives easier. Let’s continue to build amazing things while keeping our environments clean and efficient!