> A .venv folder is a Python virtual environment. You can delete it and rebuild it from requirements.txt. Here is how to find old venvs taking space on a Mac.

[← All Mac folders](https://maczentra.com/mac-folders)Mac folder guide

# Can I Delete a .venv Folder on Mac?

.venv

A .venv folder is a Python virtual environment: a private copy of Python and the packages one project needs. You can delete it whenever you can rebuild it, usually from requirements.txt or your project file. Old projects often hide hundreds of megabytes this way.

Partly safeSafe if you can rebuild it from the project’s requirements

## What is .venv on a Mac?

Each virtual environment holds its own installed packages, so data science and machine learning projects can easily reach a gigabyte or more each.

A venv also points at the Python it was created with. After a big Python upgrade it may stop working anyway, and rebuilding it is the fix.

## What’s inside

- bin, the Python and pip for this project
- lib, the installed packages
- pyvenv.cfg, which records the base Python

## How to clear .venv safely

- Find virtual environments under a folder with the first command below.
- Check that each project has a requirements.txt, pyproject.toml or lock file.
- Delete the .venv folders of projects you are not working on.
- Rebuild one when you need it with the Rebuild block below.

List (read only, run in the folder that holds your projects)

```
find . -type d -name .venv -prune
```

Rebuild later (inside the project)

```
python3 -m venv .venv.venv/bin/pip install -r requirements.txt
```

## When to keep it

- A venv with packages you installed by hand and never wrote down. Run pip freeze into a file first.

## Related guides

- [Clear pip and other developer caches](https://maczentra.com/blog/clear-homebrew-pip-gradle-caches-mac)
- [The same cleanup for node_modules](https://maczentra.com/blog/node-modules-cleanup)
- [Find large files on a Mac](https://maczentra.com/blog/find-large-files-on-mac)

## Questions people ask

Is it safe to delete a .venv folder?+

Yes, if you can rebuild it. Make sure the project lists its packages in requirements.txt or pyproject.toml first.

How do I save the packages before deleting a venv?+

Run .venv/bin/pip freeze into requirements.txt. You can reinstall from that file later.

Does deleting .venv delete my code?+

No. Your project files sit next to it. Only the installed packages go.

## See which folders fill your Mac

MacZentra, a [disk analyzer and storage cleaner for Mac](https://maczentra.com/), scans your disk locally and draws it as a Treemap or Sunburst, so a folder like this one shows up with its real size. Scanning and every visualization are free. Cleaning is a one-time $49.99 purchase, and anything you remove goes to the Trash, so it can be restored.

[Get MacZentra, ·$49.99](https://checkout.dodopayments.com/buy/pdt_0Np9H2vqU1gHOfkDwU7JZ?quantity=1)

macOS 13 Ventura or later · Apple silicon

Source: https://maczentra.com/mac-folders/venv-folder-mac
