How to clean up your Mac
When your Mac says the disk is almost full, the space is usually hiding in the same dozen places: caches, Downloads, backups, and the leftovers of developer tools that macOS files under System Data. Here is where to look, roughly how big each one gets, and how to clear it without breaking anything.
1. See what’s using the space
Open System Settings → General → Storage. The bar at the top splits your disk into Applications, Documents, Photos, iOS Files, macOS, System Data and so on, and the list below lets you open each one.
For a precise answer, ask Terminal which folders in your home are biggest:
du -sh ~/* ~/Library/* 2>/dev/null | sort -h | tail -20
The last lines are the largest. On most Macs, ~/Library and ~/Downloads are near the bottom, and for developers so is the folder their projects live in.
2. Empty the Trash
Deleted files still take up space until the Trash is emptied, which is why freeing space sometimes seems to do nothing. In the Finder choose Finder → Empty Trash, or press ⇧⌘⌫.
To stop it piling up again, open Finder → Settings → Advanced and turn on Remove items from the Trash after 30 days.
3. Clear app caches and logs
Apps keep caches in ~/Library/Caches so things load faster next time. Browsers, Spotify, Slack and messaging apps can each hold a gigabyte or more. Everything in there is safe to delete: apps rebuild what they need, at the cost of a slower first launch.
- Quit the apps you can.
- In the Finder, press ⇧⌘G and go to
~/Library/Caches. - Delete the folders inside it, not the Caches folder itself. Leave the folders starting with
com.apple.to macOS.
To see which caches are biggest first:
du -sh ~/Library/Caches/* 2>/dev/null | sort -h | tail -15
Crash reports and diagnostic logs in ~/Library/Logs can go the same way.
4. Clean out Downloads
Downloads is where installers, zip files and one-off files collect for years. Open it in the Finder, switch to list view with ⌘2, and sort by Date Added or Size. Three kinds of file are usually safe to go:
- Disk images and installers (
.dmg,.pkg) for apps you’ve already installed. - Zip files sitting next to the folder they unzipped into. You have the contents twice.
- Anything you haven’t opened in months. Move it to the Trash rather than deleting it outright, in case you change your mind.
5. Find large files
In System Settings → General → Storage, click the ⓘ next to Documents and open Large Files. Or list every file over 1 GB in your home folder from Terminal:
find ~ -xdev -type f -size +1G -not -path "*/Library/*" 2>/dev/null
Old screen recordings, exported videos, virtual machine images and disk images are the usual finds. Only you can tell which are worth keeping, so check each one before you remove it.
6. Remove apps you don’t use
In the Storage settings, click the ⓘ next to Applications to see every app with its size. To remove one, drag it from the Applications folder to the Trash. Big apps you may have forgotten about include Xcode, GarageBand, older versions of Office, and games.
Some apps leave settings and data behind in ~/Library/Application Support, in a folder named after the app. Once the app is gone, that folder can go too.
7. Delete old iPhone and iPad backups
Each local backup of an iPhone or iPad can take tens of gigabytes, and backups of phones you no longer own never go away by themselves. In System Settings → General → Storage, click the ⓘ next to iOS Files to see them with their dates, and delete the ones you don’t need. Keep at least the latest backup of every device you still use, unless it backs up to iCloud.
8. Shrink System Data
System Data is the catch-all for everything macOS doesn’t put in another category: caches, logs, Time Machine local snapshots, virtual memory, and the data of developer tools like Xcode simulators and Docker. You can’t delete it as a whole, but you can shrink most of what’s in it.
- Caches and logs: see step 3.
- Time Machine local snapshots: list them with
tmutil listlocalsnapshots /. macOS deletes them on its own when space runs low, but you can remove them now withsudo tmutil deletelocalsnapshots /. - Developer tools: see Xcode and Docker below.
Restarting your Mac also clears swap files and other temporary data, which can take System Data down by several gigabytes.
9. Delete node_modules and build folders
If you write code, this is usually the biggest win. Every JavaScript project keeps its dependencies in node_modules, often several hundred megabytes each. Rust projects keep build output in target, and Python projects keep a virtual environment in .venv. All of them come back with npm install, cargo build or pip install, so the copies in projects you aren’t working on are dead weight.
To list them with their sizes (change ~/code to wherever your projects live):
find ~/code -name node_modules -type d -prune -exec du -sh {} + 2>/dev/null | sort -h
Remove the ones you don’t need with rm -rf path/to/node_modules. Only delete a node_modules folder that sits next to a package.json, and a target folder next to a Cargo.toml; a folder with the same name somewhere else might be something you made.
10. Clear package manager caches
Package managers keep a copy of everything they have ever downloaded. Clearing these is safe; the next install just downloads again.
- npm
npm cache clean --force- Yarn
yarn cache clean- pnpm
pnpm store prune- Bun
rm -rf ~/.bun/install/cache- pip
pip cache purge- uv
uv cache clean- Cargo
rm -rf ~/.cargo/registry/cache ~/.cargo/registry/src- Go
go clean -cache -modcache- Gradle
rm -rf ~/.gradle/caches- CocoaPods
pod cache clean --all- Homebrew
brew cleanup --prune=allandbrew autoremove
Bun, pnpm and uv copy packages into your projects as APFS clones, which share storage with the cache. Clearing their cache frees less than its size suggests until the projects’ own copies are gone too.
11. Clean up Xcode
Xcode can quietly take 20 to 50 GB on top of its own size.
- DerivedData holds build products and indexes for every project you have built. Delete it with
rm -rf ~/Library/Developer/Xcode/DerivedData; Xcode rebuilds it, and the next build is slower. - Simulators for iOS versions you no longer have installed:
xcrun simctl delete unavailable. Whole simulator runtimes are listed byxcrun simctl runtime listand can be removed in Xcode → Settings → Components. - Device support files in
~/Library/Developer/Xcode/iOS DeviceSupportare copied for every iOS version you have connected a device with. Folders for versions you no longer test on can go. - Archives, in Window → Organizer, hold the debug symbols for builds you shipped. Keep the ones whose crash reports you still care about.
12. Clean up Docker
Docker keeps images, stopped containers and build cache inside one large disk image. See how much of it is reclaimable with docker system df, then:
docker system prune # stopped containers, unused networks, dangling images, build cache
docker system prune -a # …and every image no container is using
Volumes, where databases keep their data, are only removed if you add --volumes. Docker Desktop’s settings, under Resources, also let you cap how big its disk image can grow.
13. Let macOS keep it clean
Under System Settings → General → Storage, the recommendations can do some of this for you from now on:
- Store in iCloud keeps recent Desktop and Documents files on your Mac and the rest in iCloud.
- Optimize Storage removes Apple TV movies and shows you have already watched.
- Empty Trash Automatically deletes items that have been in the Trash for 30 days.
Photos has its own switch: in Photos → Settings → iCloud, choose Optimize Mac Storage to keep full-size originals in iCloud and smaller versions on your Mac.
Or do all of it at once
Declutter-inator automates most of steps 2 to 12. It sorts everything it finds into three groups: things that grow back on their own, things that cost a re-download or rebuild, and your own files, which are never selected for you. It also spots node_modules in projects you haven’t touched for a month, zip files you already unzipped, and apps you haven’t opened in six months. Nothing is removed until you confirm, and your own files go to the Trash.
curl -fsSL https://declutter.kunalbagaria.com/install | sh
Free and open source. See what it looks like or read the code.
Questions people ask
How do I clean up my Mac for free?
Empty the Trash, clear ~/Library/Caches, sort Downloads by size, delete old iPhone backups and remove apps you don’t use. If you write code, delete node_modules in old projects and clear Xcode’s DerivedData. All of it is free, either by hand with the steps above or with the free, open-source Declutter-inator.
Is it safe to delete the files in ~/Library/Caches?
Yes. Caches only exist to make apps faster, and apps rebuild them when they need them. Quit the apps first, delete the folders inside Caches rather than the folder itself, and leave the com.apple. folders to macOS.
What is System Data on a Mac, and how do I reduce it?
System Data is everything macOS doesn’t put in another category: caches, logs, Time Machine local snapshots, virtual memory and developer tool data like Xcode simulators and Docker images. Clearing caches and logs, removing local snapshots, cleaning up Xcode and Docker, and restarting your Mac all reduce it.
Why is my Mac storage still full after deleting files?
Deleted files stay in the Trash until it’s emptied. Time Machine snapshots can also hold on to deleted files for a while, and the Storage settings can take a few minutes to update. Empty the Trash, then check again after a minute.
Is it safe to delete node_modules?
Yes, as long as the project has a package.json next to it. Running npm install, yarn, pnpm install or bun install in that project brings it back.
Do I need a paid Mac cleaner app?
No. Everything a cleaner app does is in this guide, and the free, open-source Declutter-inator does it from Terminal while showing you every file before it removes anything.