Linux

Where Does DUB Store Packages and Build Data?

DUB keeps fetched packages in ~/.dub/packages with build artifacts in per project .dub folders, driven by dub.json or dub.sdl in each project.

Last updated

DUB centers D language builds on a home cache plus per project artifacts. Fetched packages accumulate in ~/.dub/packages shared across projects. Each project compiles into .dub beside its recipe file with selections locking versions.

Reproducibility comes from recipes plus selections, not from copying caches. Commit the recipe and selections, ignore build folders, and fresh machines assemble identically. Cache wipes fix corrupted downloads without touching project state.

Where DUB stores this, by platform

Linux
~/.dub/packages

Shared D package cache across projects. Clear to refetch cleanly. Project .dub folders hold per checkout builds.

Frequently asked questions

How do I clear the DUB package cache?

Delete ~/.dub/packages to force refetching, keeping project .dub build folders only if outputs matter. Version selections in dub.selections.json pin the rest. Next build downloads fresh.

How do I reproduce a DUB build?

Copy dub.json or dub.sdl plus dub.selections.json and let .dub rebuild on the new machine. Selection files lock exact dependency versions. The cache only accelerates, never substitutes.

Notice an outdated path? Let us know.