Skip to content

flox activate command


flox-activate - activate environments


flox [ <general-options> ] activate [ <options> ] [ – <command> [ <argument> ] ]


Sets environment variables and aliases, runs hooks and adds environment bin directories to your $PATH. Can be invoked from an interactive terminal to launch a sub-shell, non-interactively to produce a series of commands to be sourced by your current $SHELL, or with a command and arguments to be invoked directly.


General Options

Many flox commands wrap Nix commands of the same name, and will correspondingly pass on options and arguments directly to the underlying nix invocation. For more information on the options supported by specific Nix commands please invoke flox nix <command> help.

The following options are used specifically by flox and must be specified before the <command> argument.

-v, --verbose
Verbose mode. Invoke multiple times for increasing detail.

Debug mode. Invoke multiple times for increasing detail.

-V, --version
Print flox version.

Print flox installation prefix / Nix store path. (flox internal use only.)

Force execution in flox-bash (flox internal use only.)

Environment Options

The following option is supported by environment commands:

(-e|–environment) <name>
Selects flox environment to be modified or used. If not provided then flox will fall back to using the default environment.

Activate Options

[ – <command> [ <argument> ] ]
Command to run in the environment. Spawns the command in a subshell that does not leak into the calling process.


Absolute path to the install prefix of the environment being activated.

Set by flox activate before executing shell.hook.

If multiple environments are indicated, each shell.hook will run with its associated FLOX_ENV set properly, and the activated environment will have FLOX_ENV set to the first environment indicated on the CLI.

This variable may be used to set other environment variables such as MANPATH, PKG_CONFIG_PATH, PYTHONPATH, etc so that relevant tooling will search these directories to locate files and resources from the environment.


  • activate “default” flox environment only within the current shell (add to the relevant “rc” file, e.g. ~/.bashrc or ~/.zprofile)

    . <(flox activate)

  • activate “foo” and “default” flox environments in a new subshell

    flox activate -e foo

  • invoke command using “foo” and “default” flox environments

    flox activate -e foo -- cmd --cmdflag cmdflagarg cmdarg