Everywhere All articles Download Buy — $19

Where apps hide your files

Finding the Maven .m2 folder

Updated 2026-10-28 · 5 min read

Maven keeps every library it downloads in a hidden .m2 folder in your home directory. You can open it, see what is taking the space, and point Maven at a different location.

Where it is

~/.m2/repository       (the local repository: downloaded jars and poms)
~/.m2/settings.xml     (your user settings, if you have created one)

Both are the defaults in Maven's own settings documentation: the local repository is ${user.home}/.m2/repository, and the user settings file is ${user.home}/.m2/settings.xml. The folder starts with a dot, so Finder hides it. Choose Go > Go to Folder (⇧⌘G), paste ~/.m2, and press Return. From Terminal:

open ~/.m2

On the Mac used for this guide, ~/.m2 held only a repository folder (about 300 MB) and no settings.xml. That is normal: Maven creates the repository on first use, and the settings file only exists once you write one.

What is inside the repository

The repository is laid out by Maven coordinates, not by project. A dependency with group org.apache.commons and artifact commons-lang3 ends up under org/apache/commons/commons-lang3/<version>/, with the group's dots turned into folders. On the Mac used for this guide the top level had folders like antlr, asm, batik and bouncycastle, which are group names.

Inside a version folder you will usually find:

FileWhat it is
<artifact>-<version>.jarThe library itself.
<artifact>-<version>.pomIts project description and dependency list.
*.sha1Checksum files Maven uses to verify downloads.
_remote.repositories, *.lastUpdatedBookkeeping files Maven writes while resolving.

Maven plugins are cached here too, which is why a plain mvn package on a fresh machine downloads so much.

Where settings.xml really is

There are two settings files, and the user one wins:

If both exist, Maven merges them and the user file takes precedence. Settings files can hold mirror URLs, server credentials and proxy details, so look at yours privately and never paste it into a chat or ticket. To start one, copy the global file into ~/.m2 and trim it.

Seeing what takes the space

du -sh ~/.m2/repository
du -sh ~/.m2/repository/* | sort -h | tail -10

Both read sizes only. Because everything is a download, none of it is precious.

Trimming the repository

Quit your IDE and any running build first, then either:

  1. Move ~/.m2/repository to the Trash in Finder for a full reset. The next build downloads what it needs again.
  2. Or remove only the groups you no longer use, such as one old library folder. Maven fetches it again if a project asks.

Do not delete settings.xml casually: unlike the repository, it is your own configuration and cannot be downloaded back. Maven has no built-in "clean the repository" command in its core. The dependency plugin's mvn dependency:purge-local-repository, run inside a project, deletes that project's dependencies (transitive ones included) from the repository and, by default, downloads them again, which is the fix for one corrupted library.

Locally built artifacts count too. Running mvn install puts your own project into ~/.m2/repository, so deleting the repository also removes those, and you would need to run mvn install on those projects again.

Not to be confused with target folders

Each Maven project also has its own target/ folder next to its pom.xml, holding compiled classes and the packaged jar from mvn package. That is build output for one project, not the shared repository. mvn clean removes it, and it is safe to delete by hand because the next build recreates it. Disk space often hides there as well as in ~/.m2, so check both when you are hunting for what grew.

Moving the repository

Two documented ways:

Move the existing contents across first, or the new location starts empty. IDEs read the same setting: IntelliJ IDEA and Eclipse both offer a Maven settings screen where you can see which settings.xml and local repository they use, though the exact menu names vary by version and should be checked in yours.

Backing up or moving to a new Mac

Copy settings.xml if you have one. Skip the repository: it is rebuilt on demand and often holds hundreds of megabytes or more of downloads. If you need to build without a network on the new Mac, copying ~/.m2/repository over works, since the layout is the same on every machine.

Why search misses it

Spotlight and Finder searches leave out hidden dot-folders such as ~/.m2, so searching for a library's jar name in Finder returns nothing even when the jar is there.

Finding a jar by name next time

Everywhere indexes file names in hidden folders. Typing commons-lang3 lists every cached version of that jar and pom under ~/.m2/repository, and typing settings.xml shows the global one inside the Maven installation and your user file, if you have made one. It searches names only, not what is inside the jars. Press ⌘↵ to reveal a result.

Common questions

Where is the .m2 folder on a Mac?

In your home folder: ~/.m2. It is hidden, so open it with Go to Folder (⇧⌘G) or open ~/.m2.

Where is Maven settings.xml on a Mac?

The user file is ~/.m2/settings.xml and the global one is conf/settings.xml inside the Maven installation. The user file takes precedence, and it does not exist until you create it.

Can I delete ~/.m2/repository?

Yes. Maven downloads dependencies again on the next build. Locally installed artifacts from mvn install are removed too, so rebuild those projects if you need them.

How do I change the Maven local repository location?

Set <localRepository> in ~/.m2/settings.xml, or pass -Dmaven.repo.local=<path> on the command line.

Find any file before you finish typing

Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.

Version 2.20.3 · macOS 13+ · 4.7 MB · notarised

Related

© 2026 Caretopia Network Private Limited Everywhere for Mac Buy a licence Articles Privacy Support