What is the .m2/repository folder on my Mac?

It belongs to Maven (Java). Here’s what’s inside and the right way to deal with it.

Short answer

The .m2/repository folder is Maven’s local repository: every dependency jar and plugin your Java builds have downloaded. It’s safe to clear. The next build downloads what it needs, which takes a while the first time.

Location: ~/.m2/repository

What’s inside

  • Dependency jars and POMs
  • Maven plugins
  • Snapshot builds
Our verdict: Safe. Your Mac or your apps recreate this automatically. Removing it won’t lose anything you made.

Remove it

Delete the contents of ~/.m2/repository. Keep ~/.m2/settings.xml if you have one.

Per project

mvn dependency:purge-local-repository

removes and re-resolves just one project’s dependencies.

Find every folder like this on your Mac

Tidy Mac’s Space Map shows every big folder at its real size, and Apps › Leftovers finds folders left by apps you already deleted.

Frequently asked questions

Can I delete .m2/repository?

Safe: Your Mac or your apps recreate this automatically. Removing it won’t lose anything you made. The .m2/repository folder is Maven’s local repository: every dependency jar and plugin your Java builds have downloaded. It’s safe to clear. The next build downloads what it needs, which takes a while the first time.

Where is .m2/repository on my Mac?

~/.m2/repository. In Finder choose Go › Go to Folder and paste the path.

How big does .m2/repository get?

Usually 1 – 20 GB.

Keep reading