Developers · Maven repository

Is it safe to delete ~/.m2/repository on Mac?

Safe to removeComes back on its own
~/.m2/repository

Updated October 17, 2026By the MoreRoom team, Yando Pte. Ltd.This page as Markdown

The short answer

Yes. Rebuilt or re-downloaded automatically when needed.

What is it?

Maven’s local repository: every library and plugin Maven has downloaded for your projects, plus anything you installed locally with mvn install. Other tools, such as Gradle builds that use mavenLocal(), can read it too. Old versions are never removed automatically, so it often reaches several gigabytes.

What happens if you delete it?

Maven downloads dependencies again on the next build, which takes time and bandwidth. Artifacts that existed only locally, built with mvn install, are gone until you rebuild them.

How to remove it properly

Make sure no build is running, then move ~/.m2/repository to the Trash with Finder’s Go › Go to Folder…. Keep ~/.m2/settings.xml, which holds your repository settings and credentials.

Quit the app that uses it, then move it to the Trash. Empty the Trash when you’re sure.

Before you delete it

If you rely on locally installed snapshots of your own modules, rebuild and install them before working offline.

How MoreRoom helps

MoreRoom recognises this item, shows its real size and when it was last used, and labels it “Safe to remove”. In the free version you can move it to the Trash in one click, with Undo; Pro collects every safe item at once.

Frequently asked questions

Is it safe to delete ~/.m2/repository on Mac?

Yes. Rebuilt or re-downloaded automatically when needed. Maven downloads dependencies again on the next build, which takes time and bandwidth. Artifacts that existed only locally, built with mvn install, are gone until you rebuild them.

Will Maven repository come back after I delete it?

Yes. Maven downloads dependencies again on the next build, which takes time and bandwidth. Artifacts that existed only locally, built with mvn install, are gone until you rebuild them.

How do I remove Maven repository properly?

Make sure no build is running, then move ~/.m2/repository to the Trash with Finder’s Go › Go to Folder…. Keep ~/.m2/settings.xml, which holds your repository settings and credentials.

Guides that mention it

Related folders