Deno's cache lives in Library/Caches, and deno clean empties it
Deno keeps remote modules, npm packages and compiled code in DENO_DIR, which on a Mac is ~/Library/Caches/deno. How to find it, size it and clear it.
Deno does not use a project node_modules by default. Remote modules, npm packages and the compiled form of your TypeScript all go into one global directory, called DENO_DIR.
Where it is
| Path | What |
|---|---|
~/Library/Caches/deno | The default DENO_DIR on macOS |
.../deno/remote | Modules fetched from URLs |
.../deno/npm | npm packages used with npm: specifiers |
.../deno/gen | Transpiled and type-checked output |
node_modules in a project | Only if nodeModulesDir is set in deno.json |
deno info # prints DENO_DIR and the cache paths
du -sh ~/Library/Caches/deno/* 2>/dev/null | sort -hClearing it
deno cleandeno clean removes the whole global cache. The next run downloads and compiles what it needs, which is slower once. Because the cache is under ~/Library/Caches, it also counts as the kind of data macOS treats as disposable; the wider folder is in Library Caches.
Compared with the others
Deno's layout is simpler than npm's: one cache rather than a download cache plus a copy in every project. The trade is that it is easy to forget, because it is not next to any project. The same is true of the npm cache and the Bun cache.
Common questions
Where is the Deno cache on a Mac?
In ~/Library/Caches/deno by default. deno info prints the exact DENO_DIR in use.
How do I clear the Deno cache?
Run deno clean. It removes the global cache, and Deno downloads what it needs again on the next run.
Does Deno use node_modules?
Not by default. Only when nodeModulesDir is set in deno.json does it create a node_modules folder in the project.
Is it safe to delete ~/Library/Caches/deno?
Yes. It holds downloaded modules and compiled output, all of which Deno recreates.