---
title: Clean command
description: Remove temporary pub files and generated Melos IDE files from the workspace.
---
> ## Documentation Index
> Fetch the complete documentation index at: https://melos.invertase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

<Info>Supports all [Melos filtering](/filters) flags.</Info>

This command cleans the current workspace and all its packages of temporary pub
and generated Melos IDE files.

```bash
melos clean
```

These files include:

- `{packageRoot}/.packages`
- `{packageRoot}/.flutter-plugins`
- `{packageRoot}/.flutter-plugins-dependencies`
- `{packageRoot}/.dart_tool/package_config.json`
- `{packageRoot}/.dart_tool/package_config_subset`
- `{packageRoot}/.dart_tool/version`
- `{workspaceRoot}/.idea/runConfigurations/melos_*.xml`

To remove temporary files and reinstall dependencies, run:

```bash
melos clean
melos bootstrap
```

## Combine with filters

Clean supports all package filtering options. To clean only a subset of your
packages:

```bash
# Only clean Flutter packages or apps.

melos clean --flutter
```

## Add a postclean lifecycle script

Melos supports various command lifecycle hooks that you can define in your
root `pubspec.yaml` file.

For example, to remove generated files from `build_runner` after you run
`melos clean`, add a `post` hook script.

```yaml
# root pubspec.yaml
# ...

melos:
  command:
    clean:
      hooks:
        post: rm packages/my_package/lib/src/generated_file.g.dart
# ...

```

Another common use case is to run `flutter clean` in all Flutter packages;

```yaml
# root pubspec.yaml
# ...

melos:
  command:
    clean:
      hooks:
        # Runs "flutter clean" in all Flutter packages (`--flutter`)
        # with a concurrency of 3 at a time (`--concurrency=3`).
        post: melos exec --flutter --concurrency=3 -- "flutter clean"
# ...

```
