Is it safe to delete ~/Library/Caches/JetBrains?
- Yes, with the IDE quit. It’s the system folder of IntelliJ IDEA, PyCharm, WebStorm and the other JetBrains IDEs: caches they build again from your projects. Folders for IDE versions you no longer use can go any time.
- What it costs you: the IDE rebuilds its caches when you next open each project, which takes a while for big ones. You also lose Local History, the IDE’s own record of recent file changes, because it lives in this folder too.
- Does it come back? Yes, as soon as you open a project in that IDE again.
- SiftMac’s verdict: Rebuilds
1. What it is
Every JetBrains IDE keeps separate folders for each installed version: configuration and plugins in ~/Library/Application Support/JetBrains, logs in ~/Library/Logs/JetBrains, and a system folder here, in ~/Library/Caches/JetBrains. JetBrains describes the system folder as holding caches and Local History.
The caches are the IDE’s working data about your projects, which it can always build again by reading them. Local History is different: it’s a timeline of changes to your files that the IDE keeps by itself, apart from Git, so you can get back an edit you never committed. JetBrains says it keeps 5 working days by default.
Each major version gets its own folder, named after the product and version. Upgrading creates a new one and leaves the old folder behind, which is how several versions of the same IDE pile up.
2. Where it is
~/Library/Caches/JetBrains/<product><version>
There’s one folder per IDE and version, each starting with the product’s name. Logs sit in ~/Library/Logs/JetBrains under the same names. Your settings and plugins are not here: they’re in ~/Library/Application Support/JetBrains/<product><version> and its plugins folder.
3. How big it gets
Caches grow with the size of your projects and the libraries they use, and every old version you’ve upgraded from keeps a full folder of its own until it’s removed. To see each one, biggest last:
du -sh ~/Library/Caches/JetBrains/* ~/Library/Logs/JetBrains/* 2>/dev/null | sort -h
4. How to delete it safely
Old versions first. In the IDE you use now, choose Help › Delete Leftover IDE Directories… and pick the versions you no longer plan to use. JetBrains IDEs also delete the caches and logs folders of older versions on their own when you install a new major version, if those folders haven’t been updated in the last 180 days.
The current version’s caches. Choose File › Invalidate Caches… It removes the cache files for every project you’ve opened in this version of the IDE, and they’re recreated the next time you open those projects. Local History is kept unless you tick the option to clear it.
By hand, with every JetBrains IDE quit, to clear the whole folder:
rm -rf ~/Library/Caches/JetBrains/*
That takes Local History with it, for every IDE. If you might need an uncommitted change back, open the project and look in Local History before you clear anything.
5. What happens afterwards
- The next time you open a project, the IDE rebuilds its caches for it. Until that finishes, search and code insight are slower; big projects take a while.
- Settings, keymaps, plugins and your projects aren’t touched: they live in
~/Library/Application Support/JetBrainsand in your project folders. - Local History starts again from empty if you cleared it.
- Removing old versions’ folders changes nothing for the IDE version you use now.
6. Not the same as the settings folder
~/Library/Application Support/JetBrains looks similar but holds your configuration and plugins. JetBrains notes that these folders stay forever unless you remove them, and Help › Delete Leftover IDE Directories… is the safe way to clear old versions of them too. Android Studio, which is built on IntelliJ, offers the same kind of clean-up when you first open a new major version.
Questions
Will clearing JetBrains caches delete my settings or plugins?
No. Those live in ~/Library/Application Support/JetBrains. The caches folder holds caches and Local History.
Is Invalidate Caches the same as deleting the folder?
Close. Invalidate Caches clears the current version’s caches for every project and keeps Local History unless you ask. Deleting the folder by hand clears every version at once, Local History included.
Why are there folders for IDE versions I don’t have any more?
Upgrading to a new major version starts a new folder and leaves the old one. JetBrains IDEs remove old caches and logs after 180 days untouched; Help › Delete Leftover IDE Directories… removes them now.
Are Gradle and Maven files part of these caches?
No. Gradle keeps its own caches in ~/.gradle and Maven its repository in ~/.m2. See Gradle’s caches and Maven’s repository.
How SiftMac handles it. Its App caches category lists ~/Library/Caches/JetBrains and marks it Rebuilds. It’s left alone while any JetBrains IDE is open and checked again right before cleaning; with them all quit, its contents are cleared, Local History included.
Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works