LinuxmacOSWindows

Where Does Clojure Store Dependencies?

Clojure deps resolve through ~/.m2 with git libs in ~/.gitlibs, while each project caches its classpath in .cpcache.

Last updated

Clojure's deps.edn workflow keeps project files tiny and caches everything else. The deps.edn file declares Maven and git dependencies; .cpcache beside it stores the resolved classpath so startups stay fast. Actual jars land in the shared Maven repository.

Git dependencies get their own cache in ~/.gitlibs as bare checkouts. That split explains disk usage surprises: modest projects with git deps can pull sizable histories. Wiping .cpcache is harmless; wiping ~/.m2 or ~/.gitlibs just forces redownloads.

Where Clojure stores this, by platform

Linux
~/.m2

Shared Maven repository for JVM deps. Git deps cache separately in ~/.gitlibs. Per-project .cpcache folders regenerate from deps.edn and are safe to delete.

macOS
~/.m2

Same shared-cache layout on macOS. Homebrew Clojure installs still resolve deps here; only the CLI tools themselves live in the Cellar.

Windows
%USERPROFILE%\.m2

Same arrangement under the user profile. Deps with native bits occasionally demand dev tooling on Windows; the cache location itself never changes.

Frequently asked questions

My REPL loads the wrong dependency version. What resets it?

Delete the project's .cpcache folder and re-evaluate. It caches the resolved classpath, and stale entries cause the classic wrong-version-loaded confusion. The ~/.m2 jars stay valid.

Which Clojure folders belong in git?

Yes. Commit deps.edn (and bb.edn for tasks). The .cpcache folder regenerates per machine, and ~/.m2 plus ~/.gitlibs are shared caches that never belong in a repo.

Notice an outdated path? Let us know.