Can I delete .mypy_cache? Yes, it's safe
**/.mypy_cacheYes, you can delete .mypy_cache. It only holds mypy's incremental type-checking results, and mypy rebuilds it automatically the next time it runs. The only cost is one slower type check while the cache warms back up. Nothing about your code, your virtual environment, or your installed packages lives in there.
What it is
.mypy_cache is created by mypy, the static type checker for Python. Every time mypy checks your code, it writes its analysis of each module into this folder as pairs of meta.json and data.json files, so the next run can skip files that haven't changed. That's what makes repeat runs fast: instead of re-analyzing your entire codebase and every dependency, mypy only re-checks what you touched.
The folder appears at the root of whichever project you ran mypy in, so you can have a dozen of them scattered across your Mac, one per repo. Inside, results are split by Python version (folders named 3.11, 3.12, and so on), which is why the cache grows when you upgrade Python or test against several versions. A single project's cache is usually tens of megabytes, but large codebases checked under multiple Python versions can reach a few hundred megabytes, and it adds up across projects.
Is it safe to delete?
Deleting .mypy_cache is completely safe. It contains no source code, no configuration, and no installed packages, nothing you wrote. The only thing you lose is speed: the next mypy run has to re-check every file from scratch, which takes a few seconds on a small project and can take minutes on a large one. There's no re-download involved, since everything in the cache is computed locally.
Deleting it is also a standard troubleshooting step. When mypy reports stale or contradictory errors after a big refactor, a branch switch, or a mypy upgrade, wiping the cache and re-running often fixes it. Caches in projects you no longer type-check are pure dead weight, so clear those without a second thought. Diskmack finds every .mypy_cache folder on your Mac automatically and removes them the safe way.
How to check its size
In Finder: Open Finder, choose Go > Go to Folder (or press Cmd+Shift+G), and enter the path to the cache inside your project, for example ~/Projects/my-app/.mypy_cache. Press Return, then select the folder and press Cmd+I to see its size.
In Terminal:
du -sh ~/Projects/my-app/.mypy_cacheReplace the path with your project's location; ~ expands to your home folder, /Users/yourname. To measure every copy under your home folder at once: find ~ -maxdepth 4 -type d -name .mypy_cache -exec du -sh {} + 2>/dev/null.
How to clean it
- Open your project folder in Finder. .mypy_cache is hidden by default, so press Cmd+Shift+. (period) to show hidden files.
- Select the .mypy_cache folder and drag it to the Trash, or press Cmd+Delete.
- Repeat for any other projects where you've run mypy. The find command above lists them all.
- Empty the Trash when you're ready. The next mypy run recreates the folder on its own.
mypy has no clean command; deleting the folder is the accepted method. Add .mypy_cache/ to your .gitignore so it never ends up in a commit.
Will it come back?
Yes, immediately. The first mypy run after deletion recreates .mypy_cache and refills it as it checks your files. That's by design, and not something to fight: on an active project, the cache is a small rent you pay for fast type checks. The lasting win is in dormant projects, where the space stays freed because nothing runs mypy there anymore.
Common questions
Will deleting .mypy_cache break my project?
No. mypy stores nothing irreplaceable there. Your code, your dependencies, and your mypy configuration (mypy.ini, setup.cfg, or pyproject.toml) are untouched. The next run just takes longer while the cache rebuilds.
Why is my .mypy_cache so big?
Two common reasons: a large codebase with many dependencies mypy has to analyze, and multiple Python versions, since mypy keeps a separate cache tree per version. Folders for old versions stick around after you upgrade, so a long-lived cache can carry Python versions you no longer use.
Should I commit .mypy_cache to git?
No. It's machine-generated, changes constantly, and is useless on another machine. mypy agrees: it writes a .gitignore inside the cache folder so git ignores it by default. Adding .mypy_cache/ to your project's own .gitignore is still good practice.
Can I stop mypy from creating the cache?
Yes. Run mypy with --no-incremental to skip the cache, or move it with --cache-dir. Every run then starts cold, which gets slow on anything but small projects, so most people keep the cache during active work and clear it when a project goes quiet.
Related folders
- Can I delete .pytest_cache? Yes, and here's what it does
- Can I delete .ruff_cache? Yes, it's safe
- Can I delete __pycache__? Yes, it's safe on every Mac
- Can I Delete the .tox Folder? Yes, It's Disposable
- Can I Delete the venv Folder? Yes, With One Check First
- How to Clear the pip Cache on Your Mac (and Why It's Safe to Delete)