conda init command initializes conda for shell interaction by modifying your shell configuration files. This enables features like conda activate and conda deactivate.
Syntax
Description
Key parts of conda’s functionality require that it interact directly with the shell within which conda is being invoked. Theconda activate and conda deactivate commands specifically are shell-level commands that affect the state (e.g., environment variables) of the shell context. Other core commands like conda create and conda install also interact with the shell environment in shell-specific ways.
Shell Arguments
You can specify one or more shells to initialize:- Unix/Linux/macOS:
bash - Windows:
cmd.exeandpowershell
Options
--all
Initialize all currently available shells.
--user
Initialize conda for the current user (default).
--no-user
Don’t initialize conda for the current user.
--system
Initialize conda for all users on the system. Requires administrator/root privileges.
--reverse
Undo effects of the last conda init.
The
--reverse option will remove conda initialization from your shell configuration files.--condabin
Add the $CONDA_PREFIX/condabin directory to the PATH environment variable only. Does not install the full shell function.
The condabin directory contains only the conda executable and does not include other executables from packages installed in the base environment.
-d, --dry-run
Only display what would have been done without making any changes.
--json
Report all output as JSON.
--anaconda-prompt (Windows only)
Add an ‘Anaconda Prompt’ icon to your desktop.
Common Use Cases
Initialize conda for your shell
On Unix/Linux/macOS:Preview changes before applying
See what files will be modified:Initialize all shells
If you use multiple shells:Undo conda initialization
Remove conda from your shell configuration:Minimal PATH-only setup
If you only want conda in your PATH without the full activation setup:What Gets Modified
Depending on your shell,conda init modifies one or more of the following files:
- bash:
~/.bashrc,~/.bash_profile - zsh:
~/.zshrc - fish:
~/.config/fish/config.fish - tcsh:
~/.tcshrc,~/.cshrc - xonsh:
~/.xonshrc - powershell: PowerShell profile
- cmd.exe: Windows registry (HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)
- Add conda to your PATH
- Set up shell functions for
conda activateandconda deactivate - Configure conda shell integration
You can view the exact changes that will be made by using the
--dry-run flag before running the actual command.