Can I Delete the .tox Folder? Yes, It's Disposable
**/.toxYes, you can delete the .tox folder. It holds disposable Python test environments that tox rebuilds from scratch the next time you run it, and none of your code or data lives inside. Deleting it costs you nothing but the few minutes tox spends recreating the environments on the next run. For a project you've abandoned, the cost is zero.
What it is
tox is a Python tool that runs a project's test suite against multiple Python versions and configurations. To keep those runs isolated, it builds a separate virtual environment for each entry in the project's tox.ini (or the tox section of pyproject.toml): one for py310, one for py311, one for lint, one for docs, and so on. All of those environments live inside a hidden .tox folder in the project root, alongside a packaging environment tox uses to build the project itself.
Each environment is a full virtualenv with its own copy of the project's dependencies. That multiplies fast. A library tested against four Python versions carries four near-identical sets of installed packages, so a single .tox folder often runs a few hundred megabytes, and projects with heavy test dependencies (numpy, pandas, anything shipping compiled wheels) can push past a gigabyte. Clone a handful of open source Python projects, run their tests once, and you've scattered these folders across your Mac without noticing.
Is it safe to delete?
This one is genuinely safe. The .tox folder contains only generated material: interpreters, installed packages, logs, and build artifacts. Your source code, your tests, and your tox.ini all live outside it. Delete it and the project is untouched. The next tox run notices the environments are missing and recreates them automatically.
The only cost is time. Rebuilding means re-resolving and reinstalling dependencies for each environment, which usually takes a few minutes and pulls most packages from pip's local cache anyway. For projects you no longer touch, there is no cost at all. Diskmack finds .tox folders across your projects automatically and cleans them the safe way.
How to check its size
In Finder: Choose Go > Go to Folder in Finder, type your project's path plus /.tox, for example ~/Projects/my-library/.tox, and press Return. Select the folder and press Command-I to see its size. The folder is hidden, so Go to Folder is the reliable way in; you can also press Command-Shift-Period in any Finder window to toggle hidden files.
In Terminal:
du -sh ~/Projects/my-library/.toxSwap in your project's real path; the ~ expands to your home folder. To measure every .tox folder under your projects directory at once, run: find ~/Projects -type d -name .tox -prune -exec du -sh {} +.
How to clean it
- Open the project folder in Finder and press Command-Shift-Period to reveal hidden files if .tox isn't visible.
- Drag the .tox folder to the Trash, or select it and press Command-Delete.
- Repeat for any other projects that use tox. Each project keeps its own copy.
- Empty the Trash when you're ready to reclaim the space.
There's no dedicated cleanup command; deleting the folder is the normal way to reset it. If you'd rather not touch the filesystem yourself, running tox -r in the project rebuilds every environment from scratch anyway.
Will it come back?
Yes, the next time you run tox in that project. That's by design: the folder is a build product, not something you can permanently retire while still using the tool. If you test the project regularly, expect .tox to return to roughly its old size after one full run. If you deleted it from a project you've stopped working on, it stays gone. Either way the cycle is harmless, so delete it whenever you need the space back.
Common questions
Will deleting .tox break my project?
No. The folder holds only generated test environments. Your code, tests, and configuration live outside it, and tox recreates everything it needs on the next run.
Why is my .tox folder so large?
tox builds a separate virtual environment for every entry in tox.ini. A project tested against four Python versions holds four near-complete copies of its dependency set, so a few hundred megabytes is normal, and heavy scientific stacks can pass a gigabyte.
Is .tox the same as .venv?
No. A .venv is the environment you develop in day to day; .tox holds the throwaway environments tox builds for testing. Both can be rebuilt, but a venv needs a requirements or lock file to restore, while .tox needs nothing beyond the project's own config.
Should I add .tox to .gitignore?
Yes, and most Python project templates already do. The folder is machine-specific build output and never belongs in version control.
Related folders
- Can I Delete the venv Folder? Yes, With One Check First
- Can I delete .pytest_cache? Yes, and here's what it does
- How to Clear the pip Cache on Your Mac (and Why It's Safe to Delete)
- Can I delete .mypy_cache? Yes, it's safe
- Can I delete .ruff_cache? Yes, it's safe
- Can I delete __pycache__? Yes, it's safe on every Mac