Manual Cache Removal
-
Remove system caches: In Finder’s Go to Folder, type
/Library/Caches/
and delete unneeded files (be very careful here and avoid system-critical caches). -
Remove user caches: Go to
~/Library/Caches/
and delete the contents of folders for apps you want to reset. Note: Don’t delete the entire~/Library/Caches
directory itself, just its contents -
Empty Trash: After deleting, empty the Trash to actually free space.
Terminal-Based Cleanup
$ sudo rm -rf ~/Library/Caches/*
This wipes all user and most system caches. After running such commands, you may also want to clear DNS and I/O caches:
Other useful commands:
-
Empty Trash via Terminal:
rm -rf ~/.Trash/*
will clear your Trash (since trash files still consume space). -
Brew cleanup: If you use Homebrew, run
brew cleanup
to remove outdated formulae and cached downloads. -
Purge memory cache: On some versions,
sudo purge
can clear disk cache buffers (this mostly frees RAM, not disk space).
Developer-Specific Cleanup
Android Studio (Gradle)
Android Studio caches build data and Gradle artifacts which can grow very large. First, in Android Studio use Build → Clean Project or Rebuild Project. If issues persist, try File → Invalidate Caches / Restart to clear IDE caches. You can also delete the global Gradle cache. Close Android Studio, then in Terminal run:
Xcode
Xcode stores a lot of cache and build data. With Xcode closed, you can delete DerivedData, and Xcode Archives (your built app archives) can take tens of GB. Delete old archives via Xcode’s Organizer or simply remove ~/Library/Developer/Xcode/Archives/ folders directly. which includes build intermediates and indexes. In Finder, go to
~/Library/Developer/Xcode/DerivedData/
and delete its contents, or run:
$ rm -rf ~/Library/Developer/Xcode/DerivedData/*
$ rm -rf ~/Library/Developer/Xcode/Archives/*
You can also remove old Device Support files in ~/Library/Developer/Xcode/iOS DeviceSupport/
Note that after deleting DerivedData or caches, Xcode will run slower on first build as it reconstructs everything.
Clean the dyld cache
To free up space, you can safely delete the contents of the dyld
folder. First, quit Xcode and all Simulators to avoid any file-in-use issues. Then use either Finder or Terminal:
-
Manual (Finder): In Finder, press Shift+⌘+G, enter
~/Library/Developer/Caches/dyld
, and press Enter. This opens the dyld cache folder. Select and move all subfolders inside to the Trash. (You may be prompted for your password if any files are locked.) Empty the Trash to reclaim space. -
Terminal: Open Terminal and run a disk usage check to confirm:
If you’re working with multiple local projects on your Mac, especially as a developer, please follow these best practices to keep your system clean and optimized:
React Native Developers:
- Archived Projects: If you’re not actively working on a project, remove the
node_modules
folder from your local machine. - Backup Smartly: Upload the project to Google Drive (or another cloud solution) along with a release note mentioning the React Native version used. This will help you get it running quickly in the future.
Flutter Developers:
- Delete Build Artifacts: For any Flutter project (active or archived), delete the
build/
folder. It’s auto-generated and not needed for archiving.
Native Android & iOS Developers:
- The same rule applies: clean out build folders (
build/
,DerivedData
, etc.) from any inactive or archived project.
Keeping your workspace clean will save disk space, reduce clutter, and help avoid accidental issues when returning to old projects.