Where Does Hugo Keep Cache and Resources?
Hugo splits system cache from per project resources/_gen. The cacheDir default plus --gc cleanup.
Last updated
Hugo caches downloaded modules and remote resources under cacheDir, defaulting to $TMPDIR/hugo_cache, with per project isolation via the project name. Asset pipelines instead write into the project's own resources/_gen folder for images, CSS, and Sass output.
Both are settable in config under caches with dir and maxAge per bucket. Stale entries accumulate across rebuilds, so hugo build --gc exists to evict them. Deleting resources/_gen is safe; Hugo regenerates it on next build, slower once.
Where Hugo stores this, by platform
$TMPDIR/hugo_cache
Default cacheDir (often /tmp/hugo_cache). Override per bucket in config caches with dir and maxAge. Project outputs live in <project>/resources/_gen instead.
$TMPDIR/hugo_cache
Same TMPDIR default under macOS temp. Set cacheDir explicitly for persistent caches across reboots since tmp clears.
%TEMP%\hugo_cache
Same scheme under Windows temp. Quote paths with spaces in config. --gc cleans expired entries on any OS.
Frequently asked questions
how do i clear the hugo cache
Run hugo build --gc to evict expired entries, or delete the cacheDir folder outright for a full reset. resources/_gen inside the project regenerates on next build.
where are hugo modules downloaded
Under cacheDir/modules by default ($TMPDIR/hugo_cache/modules). Set the modules bucket dir in config to pin them somewhere persistent and shared.
Notice an outdated path? Let us know.