# Deno Cache on Mac: What DENO_DIR Holds and How to Clear It

> On macOS Deno caches remote modules, npm packages and compiled code in ~/Library/Caches/deno. deno clean empties it; scripts re-download on the next run.

- Updated: 2026-10-10
- URL: https://fresh.ist/caches/deno/

**TL;DR:** It's safe to clear. DENO_DIR, which defaults to ~/Library/Caches/deno on a Mac, holds downloaded remote modules, npm packages and transpiled output. Deleting it doesn't touch your code or deno.lock. The next deno run, test or install fetches dependencies again, so it needs a network connection. deno clean is the built-in command, and deno info shows the path first.

## Facts from the Freshist app

- Category in Clean: Deno Cache — "Deno dependency cache — re-downloaded on next run."
- Location: `~/Library/Caches/deno`
- Risk level: Medium risk — Safe to remove, but the tool that owns it re-downloads or rebuilds it on next use, which costs time and bandwidth. Listed, never pre-selected.
- Selected by default: no
- What Freshist does: Moves the selected items to the Trash, so you can undo. Nothing is deleted outright.

## What lives in the Deno cache

Deno doesn't use a per-project install step by default. When a script imports `jsr:`, `npm:` or an `https://` URL, Deno downloads the code once and keeps it in a global cache called `DENO_DIR`. On macOS that folder is `~/Library/Caches/deno` unless you override it, and `deno info` prints each part of it:

| Subfolder | Contents |
|---|---|
| `remote/` | Remote modules fetched over HTTPS, including JSR packages |
| `npm/` | npm packages used by projects without a local `node_modules` |
| `gen/` | Transpiled JavaScript from TypeScript, and other emitted code |
| `registries/` | Data the language server uses for import completions |
| `location_data/` | Origin storage, such as `localStorage` for scripts run with `--location` |

Web cache storage (the `caches` API) is kept separately in the system temporary folder, as `deno info` shows.

## How it builds up

Every version of every remote module you import stays cached. The `npm/` folder behaves like npm's own store, with one copy per package version. Working on several Deno or Fresh projects, or running scripts straight from URLs, builds that up quickly. `gen/` grows too, since Deno stores emitted JavaScript for each TypeScript file it has compiled.

Deno doesn't prune this folder on its own schedule. It stays until you clear it.

## What happens if you delete it

- The next `deno run`, `deno test` or `deno task` downloads its dependencies again and re-transpiles TypeScript, so the first run is slower.
- `deno.json`, `deno.lock` and your source files aren't in the cache; versions stay pinned by the lockfile.
- Origin storage under `location_data/` is lost. If a script stores data with `localStorage` and a fixed `--location`, that data goes too.
- The REPL history file, which lives in `DENO_DIR` by default, is removed.
- Editor features backed by the language server rebuild their data in the background.

## Look before you clear

```sh
deno info                    # DENO_DIR and each cache folder
du -sh ~/Library/Caches/deno
du -sh ~/Library/Caches/deno/*
deno clean --dry-run         # what clean would remove
```

## Clear it with Deno

```sh
deno clean
```

The [deno clean reference](https://docs.deno.com/runtime/reference/cli/clean/) describes it as removing Deno's global module cache directory. Two options make it more selective:

- `--dry-run` lists what would be removed without deleting anything.
- `--except <files>` (or `-e`) keeps the cache data the given entry points need and removes the rest. That's useful when you want to keep one active project ready offline.

Quit editors running the Deno language server first, so it doesn't rewrite files while they're being removed. If you have an older Deno without `deno clean`, upgrade with `deno upgrade`, or delete the folder `deno info` reports.

## Times to keep it

Keep the cache before travel or offline work, or on a slow connection with large npm dependencies. To pre-fetch a project instead of relying on the cache from an earlier run, `deno install` in the project folder downloads everything up front. Clear it when old projects are gone or a corrupted download breaks a run. If you also use Bun or npm, they keep separate stores: see the [Bun cache](/caches/bun/) and [npm cache](/caches/npm/) guides.

## Sources

- [Deno docs: deno clean](https://docs.deno.com/runtime/reference/cli/clean/)
- [Deno docs: deno info](https://docs.deno.com/runtime/reference/cli/info/)
- [Deno docs: environment variables (DENO_DIR, DENO_REPL_HISTORY)](https://docs.deno.com/runtime/reference/env_variables/)

## Frequently asked questions

### Does deno clean remove my REPL history?

It can. Deno's docs say DENO_REPL_HISTORY defaults to deno_history.txt inside DENO_DIR, so emptying that folder takes the history file with it. Copy it out first if you want to keep it.

### Are projects with a node_modules folder affected?

Less so. If a project uses a local node_modules directory, its npm packages are installed there and keep working. Projects that resolve npm packages from the global cache need them downloaded again.

### How do I keep the cache somewhere else?

Set the DENO_DIR environment variable to another folder. Deno uses it for all caches, and deno info prints the new location.

---

Canonical page: https://fresh.ist/caches/deno/
Official site: https://fresh.ist/ (fresh.ist only)
Generated: 2026-10-10
