title: Is it necessary to use the bash code appended to ~/.bash_profile by anaconda?
body: <p>After I install anaconda on Mac OS X, I got the following append to ~/.bash_profile. I am wondering what is the purpose of <code>conda shell.bash hook</code> (output shown below). Is it sufficient to just add <code>/Users/xxx/opt/anaconda3/bin/</code> to $PATH. Instead of using the bash code appended to <code>~/.bash_profile</code>?</p>
  
  <pre><code>__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/xxx/opt/anaconda3/bin/conda' shell.bash hook 2&gt; /dev/null)"
  if [ $? -eq 0 ]; then
      \eval "$__conda_setup"
  else
      if [ -f "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh" ]; then
          . "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh"
          CONDA_CHANGEPS1=false conda activate base
      else
          \export PATH="/Users/xxx/opt/anaconda3/bin:$PATH"
      fi
  fi
  unset __conda_setup
  </code></pre>
  
  <pre><code>$ conda shell.bash hook
  export CONDA_EXE='/Users/pengy/opt/anaconda3/bin/conda'
  export _CE_M=''
  export _CE_CONDA=''
  export CONDA_PYTHON_EXE='/Users/pengy/opt/anaconda3/bin/python'
  
  # Copyright (C) 2012 Anaconda, Inc
  # SPDX-License-Identifier: BSD-3-Clause
  
  __add_sys_prefix_to_path() {
      # In dev-mode CONDA_EXE is python.exe and on Windows
      # it is in a different relative location to condabin.
      if [ -n "${_CE_CONDA}" ] &amp;&amp; [ -n "${WINDIR+x}" ]; then
          SYSP=$(\dirname "${CONDA_EXE}")
      else
          SYSP=$(\dirname "${CONDA_EXE}")
          SYSP=$(\dirname "${SYSP}")
      fi
  
      if [ -n "${WINDIR+x}" ]; then
          PATH="${SYSP}/bin:${PATH}"
          PATH="${SYSP}/Scripts:${PATH}"
          PATH="${SYSP}/Library/bin:${PATH}"
          PATH="${SYSP}/Library/usr/bin:${PATH}"
          PATH="${SYSP}/Library/mingw-w64/bin:${PATH}"
          PATH="${SYSP}:${PATH}"
      else
          PATH="${SYSP}/bin:${PATH}"
      fi
      \export PATH
  }
  
  __conda_hashr() {
      if [ -n "${ZSH_VERSION:+x}" ]; then
          \rehash
      elif [ -n "${POSH_VERSION:+x}" ]; then
          :  # pass
      else
          \hash -r
      fi
  }
  
  __conda_activate() {
      if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
          # Handle transition from shell activated with conda &lt;= 4.3 to a subsequent activation
          # after conda updated to &gt;= 4.4. See issue #6173.
          PS1="$CONDA_PS1_BACKUP"
          \unset CONDA_PS1_BACKUP
      fi
  
      \local cmd="$1"
      shift
      \local ask_conda
      OLDPATH="${PATH}"
      __add_sys_prefix_to_path
      ask_conda="$(PS1="$PS1" "$CONDA_EXE" $_CE_M $_CE_CONDA shell.posix "$cmd" "$@")" || \return $?
      PATH="${OLDPATH}"
      \eval "$ask_conda"
      __conda_hashr
  }
  
  __conda_reactivate() {
      \local ask_conda
      OLDPATH="${PATH}"
      __add_sys_prefix_to_path
      ask_conda="$(PS1="$PS1" "$CONDA_EXE" $_CE_M $_CE_CONDA shell.posix reactivate)" || \return $?
      PATH="${OLDPATH}"
      \eval "$ask_conda"
      __conda_hashr
  }
  
  conda() {
      if [ "$#" -lt 1 ]; then
          "$CONDA_EXE" $_CE_M $_CE_CONDA
      else
          \local cmd="$1"
          shift
          case "$cmd" in
              activate|deactivate)
                  __conda_activate "$cmd" "$@"
                  ;;
              install|update|upgrade|remove|uninstall)
                  OLDPATH="${PATH}"
                  __add_sys_prefix_to_path
                  "$CONDA_EXE" $_CE_M $_CE_CONDA "$cmd" "$@"
                  \local t1=$?
                  PATH="${OLDPATH}"
                  if [ $t1 = 0 ]; then
                      __conda_reactivate
                  else
                      return $t1
                  fi
                  ;;
              *)
                  OLDPATH="${PATH}"
                  __add_sys_prefix_to_path
                  "$CONDA_EXE" $_CE_M $_CE_CONDA "$cmd" "$@"
                  \local t1=$?
                  PATH="${OLDPATH}"
                  return $t1
                  ;;
          esac
      fi
  }
  
  if [ -z "${CONDA_SHLVL+x}" ]; then
      \export CONDA_SHLVL=0
      # In dev-mode CONDA_EXE is python.exe and on Windows
      # it is in a different relative location to condabin.
      if [ -n "${_CE_CONDA+x}" ] &amp;&amp; [ -n "${WINDIR+x}" ]; then
          PATH="$(\dirname "$CONDA_EXE")/condabin${PATH:+":${PATH}"}"
      else
          PATH="$(\dirname "$(\dirname "$CONDA_EXE")")/condabin${PATH:+":${PATH}"}"
      fi
      \export PATH
  
      # We're not allowing PS1 to be unbound. It must at least be set.
      # However, we're not exporting it, which can cause problems when starting a second shell
      # via a first shell (i.e. starting zsh from bash).
      if [ -z "${PS1+x}" ]; then
          PS1=
      fi
  fi
  
  
  conda activate base
  </code></pre>