Loading course…

Read as text

Your Mac isn’t full. It’s full of caches.

If you code on a Mac, every npm install, every Xcode build and every app update leaves a copy behind. None of it is your work. All of it re-downloads by itself the next time a tool needs it. Paste this into Terminal as one line:

setopt nullglob; rm -rf ~/Library/Caches/Yarn ~/.npm/_cacache ~/Library/Developer/Xcode/DerivedData ~/Library/Caches/ms-playwright* ~/Library/Caches/*ShipIt ~/Library/Caches/*-updater && df -h /System/Volumes/Data

Yarn + npm cache Every package you ever installed, zipped. Your projects don’t need it. ✓ yes

Xcode DerivedData Old build output for every iOS/Mac project. Next build is a bit slower, once. ✓ yes

ms-playwright Test browsers (Chromium, Firefox, WebKit). npx playwright install brings them back. ✓ yes

*ShipIt / *-updater Leftover update downloads from Electron apps (Cursor, VS Code, Claude, Notion…). ✓ yes

0 files of my own deleted

df -h at the end prints your new free space

setopt nullglob matters: in zsh (the Mac default), if one * path matches nothing, the whole command quietly refuses to run. This line stops that.

“Permission denied”? Your paste broke in two.

When I ran it, the command got pasted as two lines. Terminal hits Enter at the end of each line, so it ran as two separate commands:

~ % rm -rf ~/Library/Caches/Yarn ~/.npm/_cacache ~/Library/Developer/Xcode/DerivedData ~/Library/Caches/ms-playwright* ~ % ~/Library/Caches/*ShipIt ~/Library/Caches/*-updater && df -h /System/Volumes/Data zsh: permission denied: ~/Library/Caches/com.anthropic.claudefordesktop.ShipIt

Line 1 worked

It starts with rm -rf, so it deleted the Yarn, npm, Xcode and Playwright caches. That’s where most of the space came from.

Line 2 had no command

It starts with a folder path. zsh tried to run that folder like a program, and you can’t run a folder, so: “permission denied”. Nothing broke. The updater folders just didn’t get deleted.

The fix

Paste it as one line (copy from the page before), or run the second half on its own with rm -rf in front:

setopt nullglob; rm -rf ~/Library/Caches/*ShipIt ~/Library/Caches/*-updater

On my Mac that’s another 3.4 GB (Cursor’s updater alone was 1 GB). Quit those apps first.

Rule for any long command: if your paste shows up as two prompts (~ % twice), stop. Press Ctrl+C and paste again into a wider window, or end each line with a \ so the shell reads it as one.

I still had 30 GB more.

Run this to see what’s big on your Mac before deleting anything:

du -sh ~/Library/Caches ~/.cache ~/.gradle ~/Library/Developer ~/Library/Android 2>/dev/null | sort -h

Android / Gradle rm -rf ~/.gradle/caches 15 GB

AI models (Hugging Face) du -sh ~/.cache/huggingface/hub/* then delete models you don’t use 4.8 GB

iOS Simulators xcrun simctl delete unavailable 3.8 GB

Android emulators Android Studio → Device Manager → delete old images 2.1 GB

pnpm pnpm store prune 0.7 GB

Docker docker system prune -a (old images + stopped containers) —

Homebrew brew cleanup --prune=all 0.2 GB

CocoaPods pod cache clean --all 0.2 GB

Python pip cache purge · uv cache clean 0.4 GB

Bun bun pm cache rm —

Old Xcode archives Xcode → Window → Organizer → delete old builds —

~80 GB total, with the first command

0 apps to buy. Everything here is built in

Caches are safe. These are not.

Docker volumes

Skip --volumes on docker prune unless you’re sure. Volumes hold your local databases.

Application Support

~/Library/Application Support holds app data and logins, not caches. Uninstall the app instead.

Whole ~/Library/Caches

Pick folders. Wiping it all logs you out of things and makes apps rebuild for minutes.

“Cleaner” apps

You just did what they charge for, and you can see every folder you touched.

“System Data” still huge?

Usually Time Machine snapshots. List them with tmutil listlocalsnapshots /. macOS removes them when space runs low. Then check System Settings → General → Storage for big files and old iOS backups.

  • Quit Xcode, Cursor, VS Code
  • Paste the one-line command
  • Run the du line, find your big ones
  • Clean only what you use
  • Empty the Trash
  • Repeat every month or two

Next →

Space is back. Now stop filling it. Turn the page.

Get 50 GB back on your Mac with one command — free guide by Sanskar Tiwari - Sanskar Tiwari