How to clear the .next and .turbo cache

.next is Next.js build output plus its build cache; .turbo holds Turborepo’s local task cache (Turborepo 2.0+ keeps it in .turbo/cache). Both are rebuilt automatically, and deleting them is also the classic fix for strange dev-server errors.

These commands permanently delete files. Most are caches the tool rebuilds on its own (the next build or install is slower and may need internet). Anything that can hold data you cannot re-download is flagged on the page. Read each command, then copy and run it yourself. devdisk never runs cleanup commands for you.

One project

Stop next dev first.

macOS / Linux
rm -rf .next .turbo node_modules/.cache
Windows (PowerShell)
Remove-Item -Recurse -Force .next, .turbo, node_modules\.cache -ErrorAction SilentlyContinue

To keep the build output but drop only Next’s build cache, delete .next/cache instead.

A whole monorepo or code folder

List first, skipping anything inside node_modules:

macOS / Linux
find . -name node_modules -prune -o -type d \( -name .next -o -name .turbo \) -prune -print

Read the list. When it only shows folders you mean, replace -print with -exec rm -rf {} + and run it again.

Older Turborepo

Before 2.0, Turborepo cached in node_modules/.cache/turbo. The one-project command above covers both locations.

Measure with devdisk

devdisk is a free, read-only scanner. It finds every .next (next to a package.json) and every .turbo folder and lists them under Safe to regenerate. It never deletes anything; it only shows sizes and writes a cleanup script you read and run yourself.

macOS / Linux
curl -fsSLO https://disk.sadana.app/devdisk.py && python3 devdisk.py
Windows (PowerShell)
iwr https://disk.sadana.app/devdisk.py -OutFile devdisk.py; py devdisk.py

Run free scannerSample report

Want one-click cleanup?

A planned devdisk desktop app for Mac and Windows: live treemap, cleanup that moves files to the Trash, scheduled scans. One email when it launches, with an early-supporter price. Your address is used only for that, and every email has an unsubscribe link.

FAQ

Is deleting .next safe?

Yes. next dev and next build recreate it. The next build is slower once.

Should .next or .turbo be in git?

No. Both belong in .gitignore.

Will this delete node_modules?

No. Only node_modules/.cache, a cache folder tools rebuild. Your installed packages stay.

More cleanup guides