Skip to content

Instantly share code, notes, and snippets.

@duonghuuphuc
Created January 28, 2025 10:03
Show Gist options
  • Select an option

  • Save duonghuuphuc/836d99200390b6179ec51e3c50ce18b3 to your computer and use it in GitHub Desktop.

Select an option

Save duonghuuphuc/836d99200390b6179ec51e3c50ce18b3 to your computer and use it in GitHub Desktop.
[macOS] Disable Automatic Activation of the base Conda Environment

[macOS] Disable Automatic Activation of the base Conda Environment

After installing Anaconda on your macOS system, the base environment is automatically activated each time you open a Terminal window. To disable this behavior, follow these steps:

Steps to Prevent Automatic Activation

  1. Open the Terminal
    After installing Anaconda, launch a Terminal window or Anaconda Navigator.

  2. Check the .zshrc Configuration File
    In the Terminal, run the following command to check if Conda's initialization script is present in your .zshrc file:

    $ nano ~/.zshrc

    Look for the Conda initialization block, which typically appears as:

    # >>> conda initialize >>>
    # !! Contents within this block are managed by 'conda init' !!
    __conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
    if [ $? -eq 0 ]; then
        eval "$__conda_setup"
    else
        if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
            . "/opt/anaconda3/etc/profile.d/conda.sh"
        else
            export PATH="/opt/anaconda3/bin:$PATH"
        fi
    fi
    unset __conda_setup
    # <<< conda initialize <<<
  3. Disable Auto-Activation of the base Environment
    To prevent the base environment from automatically activating, execute the following command in the Terminal:

    $ conda config --set auto_activate_base false
  4. Verify the Configuration
    You can confirm that the setting has been applied by checking the ~/.condarc file. A new line should have been added:

    channels:
      - defaults
      - https://repo.anaconda.com/pkgs/main
      - https://repo.anaconda.com/pkgs/r
    ssl_verify: true
    auto_activate_base: false

By following these steps, the base environment will no longer activate automatically whenever you open a new Terminal window.

@baslia
Copy link

baslia commented Dec 13, 2025

Thank you! This has been an issue for years on my Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment