> ## Documentation Index
> Fetch the complete documentation index at: https://flox.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# flox edit

## NAME

flox-edit - edit the declarative environment configuration

## SYNOPSIS

```text theme={null}
flox [<general options>] edit
     [-d=<path> | -r=<owner/name>]
     [[-f=<file>] | -n=<name> | --sync | --reset]
```

## DESCRIPTION

### Transactionally edit the environment manifest.

By default, invokes an editor with a copy of the local manifest for the
user to interactively edit. The editor is found by querying `$EDITOR`,
`$VISUAL`, and then by looking for common editors in `$PATH`. The
manifest of an environment on FloxHub or in a different directory can be
edited via the `-r` or `-d` flags respectively. See
[`manifest.toml`](/man/manifest.toml) for more details on the
manifest format.

Once the editor is closed the environment is built in order to validate
the edit. If the build fails you are given a chance to continue editing
the manifest, and if you decline, the edit is discarded. This
transactional editing prevents an edit from leaving the environment in a
broken state. One exception is the `-n` flag, which renames a local
environment but does not rebuild it.

The environment can be edited non-interactively via the `-f` flag, which
replaces the contents of the manifest with those of the provided file.

### Sync the local manifest with the current generation.

When using environments that were pushed to or pulled from FloxHub,
changes to the local manifest in `.flox/env/manifest.toml` will block
the use of the environment commands
`flox {install, uninstall, edit, upgrade}`. To proceed, you can run
either:

* `flox edit --sync` to commit your local changes to a new generation
* `flox edit --reset` to discard your local changes and reset to the
  latest generation

## OPTIONS

### Edit Options

`-f`, `--file`\
Replace environment manifest with that in `<file>`. If `<file>` is `-`,
reads from stdin.

`-n`, `--name`\
Rename the environment to `<name>`. Only works for local environments.

`-s`, `--sync`\
Create a new generation from the current local environment (Only
available for managed environments)

`--reset`\
Reset the environment to the current generation (Only available for
managed environments)

### Environment Options

If no environment is specified for an environment command, the
environment in the current directory or the active environment that was
last activated is used.

`-d`, `--dir`\
Path containing a .flox/ directory.

`-r`, `--reference`\
A FloxHub environment, specified in the form `<owner>/<name>`.

`-D`, `--default`\
Use your default environment (`<your-user>/default`). When
unauthenticated in an interactive context, you will be prompted to log
in. In non-interactive contexts (e.g., scripts or CI), this flag will
fail with an error when authentication is missing.

### General Options

`-h`, `--help`\
Prints help information.

The following options can be passed when running any `flox` subcommand
but must be specified *before* the subcommand.

`-v`, `--verbose`\
Increase logging verbosity. Invoke multiple times for increasing detail.

`-q`, `--quiet`\
Silence logs except for errors.

## ENVIRONMENT VARIABLES

`$EDITOR`, `$VISUAL`\
Override the default editor used for editing environment manifests and
commit messages.

## SEE ALSO

[`flox-push`](/man/flox-push), [`flox-pull`](/man/flox-pull),
[`flox-activate`](/man/flox-activate)
