Skip to main content
Clean parts of your system touched by pixi.

Usage

pixi clean [OPTIONS] [COMMAND]

Description

The pixi clean command removes cached data and environments. It can clean:
  • Workspace environments (.pixi folder)
  • System-wide cache (conda packages, PyPI wheels, repodata, etc.)
  • Build-related caches

Subcommands

pixi clean cache

Clean the global cache directory.
pixi clean cache [OPTIONS]

Options

Workspace Options

--environment
string
The specific environment directory to remove.
pixi clean --environment prod
pixi clean --environment test
--activation-cache
boolean
Only remove the activation cache.
pixi clean --activation-cache
pixi clean --environment prod --activation-cache
--build
boolean
Only remove the pixi-build cache.
pixi clean --build

Cache Options

--pypi
boolean
Clean only the PyPI related cache.
pixi clean cache --pypi
--conda
boolean
Clean only the conda related cache.
pixi clean cache --conda
--repodata
boolean
Clean only the repodata cache.
pixi clean cache --repodata
--mapping
boolean
Clean only the conda-pypi mapping cache.
pixi clean cache --mapping
--exec
boolean
Clean only the exec cache (cached command executions).
pixi clean cache --exec
--build-backends
boolean
Clean only the build backends environments cache.
pixi clean cache --build-backends
--build
boolean
Clean only the build-related cache (git, work directories, built packages).
pixi clean cache --build
--yes
boolean
Answer yes to all prompts. Useful for automation.
pixi clean cache --yes
pixi clean cache -y

Examples

Clean workspace environments

Remove all environments in the current workspace:
pixi clean
This removes:
  • Environment directories (.pixi/envs/)
  • Solve group environments
  • Task cache
  • Activation cache
  • Workspace build cache

Clean specific environment

Remove only one environment:
pixi clean --environment test

Clean activation cache only

Remove just the activation cache without removing environments:
pixi clean --activation-cache

Clean all cache

Remove all cached data (interactive prompt):
pixi clean cache

Clean specific cache types

Remove only PyPI cache:
pixi clean cache --pypi
Remove conda package cache:
pixi clean cache --conda
Remove repodata cache to force refresh:
pixi clean cache --repodata

Clean multiple cache types

Combine flags to clean specific caches:
pixi clean cache --pypi --conda
pixi clean cache --repodata --mapping

Clean build caches

Remove build-related caches:
# Clean build backends
pixi clean cache --build-backends

# Clean all build cache
pixi clean cache --build

# Clean workspace build cache
pixi clean --build

Non-interactive cleaning

Clean without confirmation prompts:
pixi clean cache --yes
pixi clean cache -y

Cache Locations

By default, pixi caches data in:
  • Linux: ~/.cache/rattler/
  • macOS: ~/Library/Caches/rattler/
  • Windows: %LOCALAPPDATA%\rattler\Cache
Cache structure:
~/.cache/rattler/
├── cache/                  # Conda package cache (--conda)
├── pkgs/                   # PyPI wheels cache (--pypi)
├── repodata/               # Channel repodata (--repodata)
├── pypi-mapping/           # Conda-PyPI name mapping (--mapping)
├── envs/                   # Exec cache (--exec)
├── build-tool-envs/        # Build backends (--build-backends)
├── git/                    # Git repos for builds (--build)
├── build-work/             # Build work directories (--build)
└── built-packages/         # Built packages (--build)

When to Clean

The cache can grow large over time. Use pixi info --extended to check cache size, then clean unused caches.
If you encounter strange package resolution or download errors, cleaning the repodata cache can help:
pixi clean cache --repodata
To recreate environments from scratch:
pixi clean
pixi install
If builds are failing or producing unexpected results:
pixi clean cache --build
pixi clean --build
After changing channels or updating package sources:
pixi clean cache --repodata --mapping

Safety

Cleaning the cache will cause packages to be re-downloaded on next install. This is safe but may take time depending on your internet connection.
Cleaning workspace environments does not affect the lock file. Running pixi install will recreate the environments from the lock file.