One eternal challenge for app developers using a MacBook is, without fail, "not enough storage." If you're running a 256GB or 512GB model, at some point the System Data entry starts creeping past 50GB, then 100GB, squeezing your MacBook's storage to the limit.

Have you tried to save space by moving your Flutter project and dev environment onto an external SSD/HDD, only to run into the bizarre situation where you start getting "Symlink / Permission denied" build errors while your System Data keeps growing anyway?

Today I'm tracking down the hidden cause behind more than 100GB of vanished MacBook System Data, and laying out, step by step, exactly how to set up a Flutter development environment on an external drive without hitting build errors.


1. The Symptoms: Two Tragedies From Trying to Save Space

🚨 Summary of what happened:
  • Symptom 1 (storage explosion): I moved my Flutter project to an external SSD to free up space on the MacBook's internal SSD, but the MacBook's System Data section ended up breaking past 100GB anyway.
  • Symptom 2 (build errors): Building a Flutter app located on the external drive for the iOS Simulator or via CocoaPods threw a variety of file-system permission errors, including Operation not permitted, Symlink error, and Pod install failure.

2. Root Cause Analysis: "External Drive Format" and "Hidden Build Caches"

This problem is caused by a combination of two main factors: (1) the external drive's file system format and (2) the default cache paths used by your development tools.

β‘  The Fatal Trap: exFAT Format and the Absence of Symbolic Links

When you buy a new external SSD, it's often pre-formatted as exFAT by default so that it can be used on both Windows and Mac. However, Flutter, Xcode, CocoaPods, and the Dart package manager all make heavy use of UNIX-style symbolic links (symlinks) and POSIX file permissions (chmod).

⚠️ The limits of exFAT:
The exFAT file system doesn't support symbolic links or detailed permission settings. Because of this, the Flutter build pipeline breaks down midway through, and the huge temporary parsing files generated on a failed build never get cleaned up β€” instead they end up stranded on the MacBook's internal disk, in /var/folders and the Temp area, causing a System Data storage explosion.

β‘‘ Why Moving Just the Project Isn't Enough: Caches Left Behind on the Internal SSD

Moving only the project's source code folder to the external drive doesn't take the build cache along with it. By default, the following paths keep piling up on the MacBook's internal SSD regardless.

  • ~/Library/Developer/Xcode/DerivedData: Xcode's temporary build artifacts (accumulates tens of GB)
  • ~/.pub-cache: the download store for Dart/Flutter dependency packages
  • ~/Library/Caches/CocoaPods: the cache for iOS Pod library files
  • ~/.gradle: Android build cache and Gradle binaries

3. Step-by-Step Fix (Troubleshooting)

Step 1. Finding the Culprit: Tracking Down Where the 100GB of System Data Actually Lives

Open Terminal and track down the largest folders on the internal SSD, ranked from biggest to smallest.

# 1. Check the largest items inside the Library folder
sudo du -sh ~/Library/* | sort -rh | head -n 10

# 2. Check the size of Xcode's DerivedData
du -sh ~/Library/Developer/Xcode/DerivedData

# 3. Check the size of the Flutter Pub cache
du -sh ~/.pub-cache

Once you check, you'll see for yourself that the DerivedData folder, .pub-cache, and /var/folders can add up to anywhere from tens to hundreds of gigabytes.


Step 2. Reformatting the External Drive (exFAT βž” APFS)

To do Flutter and Xcode development on an external drive, you must use the APFS (Apple File System) format.

🚨 Warning: Reformatting erases all data on the external drive, so make sure to back up your existing data to your MacBook or another storage device before proceeding!
  1. Launch Disk Utility on your MacBook
  2. From the View menu at the top, select Show All Devices
  3. Select the external SSD's top-level drive, then click [Erase]
  4. Set the format to APFS (or Mac OS Extended (Journaled)), then proceed with erasing

Step 3. Redirecting Cache Paths to the External Drive and Setting Environment Variables

To save space on the internal SSD, redirect the PUB_CACHE location to the external drive you formatted as APFS.

# Open your shell config file (~/.zshrc)
nano ~/.zshrc

# Add the environment variable below (assuming your external drive is named ExternalSSD)
export PUB_CACHE="/Volumes/ExternalSSD/pub-cache"

# Apply the changes
source ~/.zshrc

You can also dramatically cut down on internal SSD usage by changing Xcode's DerivedData storage path β€” go to the Xcode menu βž” Settings (Preferences) βž” Locations βž” Derived Data and point it to a dedicated folder on the external drive.

Step 4. Thoroughly Cleaning Up Leftover Build Debris and Snapshots on the Internal SSD

Finally, force-clean the cache files and APFS local Time Machine snapshots that have been piling up on the internal SSD for a long time.

# 1. Delete all of Xcode's DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData/*

# 2. Clear the CocoaPods cache
pod cache clean --all

# 3. Clean up Flutter's existing cache
flutter clean

# 4. (Optional) Clean up APFS local Time Machine snapshots counted as System Data
tmutil listlocalsnapshots /
sudo tmutil thinlocalpurgablespace / 100000000000 4

4. Conclusion and Summary Checklist

πŸ’‘ Key takeaways for a MacBook + external drive dev setup:
  • The format must be APFS: on an exFAT-formatted external drive, Flutter/iOS development will produce symlink errors and leaking build debris that eats up storage.
  • Move your cache paths too: it's not enough to move just the project files β€” pointing PUB_CACHE and DerivedData to the external drive is what actually keeps your MacBook's internal SSD clean.
  • Clean your caches regularly: running flutter clean and clearing out DerivedData periodically can free you from that 100GB+ System Data warning for good.

If you've been stressed out by low MacBook storage and mysterious Flutter build errors on an external drive, go check your external drive's format and build cache paths right now!