Documents was 7.6 GB, and 6.2 GB of it was not documents
On a developer's Mac the Documents folder fills with code dependencies and build output. Measured: 7.6 GB, 208,906 files, 82 percent regenerable.
Documents is where people keep projects, so it is where project tooling ends up. What System Settings calls Documents can be mostly things nobody wrote.
| Inside Documents | Size | Regenerable? |
|---|---|---|
Build output (target, dist, build, .next) | 3.2 GB | Yes, by building again |
node_modules, 12 folders | 2.4 GB | Yes, by installing again |
.git history, 9 repositories | 0.6 GB | Only if pushed somewhere |
| Everything else | 1.4 GB | This is the actual work |
6.2 GB of 7.6 GB, 82 percent, came back with one command per project. Two hundred thousand files is also why Finder, Spotlight and backups are slow on this folder.
Measure yours
cd ~/Documents
find . -type d -name node_modules -prune -exec du -sh {} + 2>/dev/null | sort -h | tail
find . -type d \( -name node_modules -prune \) -o -type d \( -name target -o -name dist -o -name build -o -name .next \) -prune -print0 2>/dev/null | xargs -0 du -sh 2>/dev/null | sort -h | tail
find . -type f | wc -lThe second command skips anything inside node_modules, because packages ship their own dist folders and counting both would count some bytes twice.
What to do
- Old projects: delete
node_modulesand build output, keep the source. Archiving old projects covers doing it safely. - Repositories: a
.gitfolder is only safe to lose if everything is pushed.git statusandgit log origin/main..tell you. - iCloud: if Desktop and Documents sync to iCloud Drive, every
node_modulesfile syncs too. Keep code outside Documents, or add.nosyncto a folder name, as in iCloud Drive taking up space.
The per-project picture is in node_modules taking up space.
Common questions
Why is my Documents folder so big on a Mac?
On a developer's Mac, mostly dependencies and build output. On the Mac measured, 82 percent of 7.6 GB was node_modules, build folders and git history.
Is it safe to delete node_modules in Documents?
Yes. Each is rebuilt from the project's lockfile with npm install, pnpm install or yarn.
Should I keep code in the Documents folder?
Not if Documents syncs to iCloud Drive, because every dependency file syncs too. A folder such as ~/Developer avoids that.
How do I count the files in my Documents folder?
Run find ~/Documents -type f | wc -l in Terminal. The Mac measured had 208,906.