Skip to main content
Print the pixi environment activation script. You can source the script to activate the environment without needing pixi itself.

Usage

Options

string
Sets the shell for which to generate the activation script.Options: bash, zsh, xonsh, cmd, powershell, fish, nushellIf not specified, pixi will auto-detect the shell from the parent process or environment.
path
The path to the pixi.toml or pyproject.toml file.
boolean
Install the environment as defined in the lockfile, without updating it.
boolean
Check if the lockfile is up-to-date before installing the environment. Errors if the lockfile is out-of-date.
string
The environment to activate in the script.
boolean
Emit the environment variables set by running the activation as JSON.This option is mutually exclusive with --shell.
boolean
Don’t install the environment, only generate the activation script.
boolean
default:"true"
Include prompt modification in the activation script (can be configured in the global config).

Examples

Source the activation script

Get environment variables as JSON

Output:

Activate environment in a specific shell

Use Cases

CI/CD Integration

Activate pixi environments in CI without keeping pixi in the PATH:

Custom Shell Integration

Integrate pixi activation into your shell’s RC file:

Docker Containers

Activate environments in Docker without keeping the pixi binary:

Environment Variable Inspection

Inspect what environment variables pixi sets:

Supported Shells

The command generates activation scripts for:
  • bash - Bourne Again Shell
  • zsh - Z Shell
  • fish - Friendly Interactive Shell
  • xonsh - Python-powered shell
  • powershell - PowerShell (Windows/Unix)
  • cmd - Windows Command Prompt
  • nushell - A new type of shell
If --shell is not specified, pixi will attempt to detect your shell from the parent process or environment variables.

JSON Output Format

When using --json, the output contains:
This format is useful for:
  • Parsing in scripts
  • IDE integrations
  • Debugging environment setups

Differences from pixi shell

  • pixi shell-hook prints the activation script
  • pixi shell executes an interactive shell
  • Both activate the same environment
  • shell-hook is useful for integration scenarios where you need the raw activation commands
Use pixi shell-hook --json to inspect exactly what environment variables pixi sets, which is helpful for debugging and integration work.