LinuxCommandLibrary

conda-init

Initialize Conda for shell

TLDR

Initialize a specific shell (if none is specified, defaults to bash for UNIX and powershell for Windows)

$ conda init [zsh|bash|powershell|fish|tcsh|xonsh]
copy

Initialize all available shells
$ conda init --all
copy

Initialize conda for all users on the system
$ conda init --system
copy

Don't initialize conda for the current user
$ conda init --no-user
copy

Add condabin/ directory to $PATH
$ conda init --condabin
copy

Undo effects of the last conda init
$ conda init --reverse
copy

SYNOPSIS

conda init [shell_name] [options]

PARAMETERS

--all
    Initialize for every supported shell

--dry-run
    Show changes without applying them

--install
    Install standalone conda-init binary

--json
    Output changes in JSON format

--no-user
    Skip user-level initialization

--reverse
    Undo previous initialization

--root-prefix <dir>
    Specify conda root prefix

--system
    Initialize system-wide

--user
    Initialize for current user only

--verbose
    Increase output verbosity

--dev
    Development mode initialization

DESCRIPTION

conda init (invoked via conda-init binary in some setups) modifies shell configuration files to enable automatic activation of the base conda environment upon shell startup. It prepends the conda bin directory to $PATH, sets up prompt customization with (base) indicator, and configures hooks for environment management.

This command supports multiple shells including bash, zsh, fish, powershell, and xonsh. It creates or appends to files like ~/.bashrc, ~/.zshrc, or system-wide profiles. The process ensures conda is available without manual sourcing, streamlining package management for Python, R, and other languages.

Key benefits include seamless environment switching and avoiding PATH conflicts. Use --reverse to undo changes. It's essential post-Anaconda/Miniconda installation for full functionality.

CAVEATS

Modifies shell config files irreversibly without --reverse; may conflict with virtualenv or pyenv; requires careful use in multi-user systems.

SHELL NAMES

Supported: bash, zsh, fish, powershell, xonsh, tcsh; omit for current shell.

EXAMPLE USAGE

conda init bash or conda init --all --reverse to undo all.

HISTORY

Introduced in conda 4.4 (2017) for bash; expanded to multi-shell in 4.6+; standalone conda-init binary added in 23.7.4 (2023) for installer use.

SEE ALSO

conda(1), mamba(1), micromamba(1)

Copied to clipboard