2

So according to the official doc, we only need to delete the export path line. But it looks like all of the file is about conda. Can you also explain what is .bash_profile, can the file be deleted?

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/u1/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /de$
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/u1/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/u1/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/u1/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
wangge
  • 145
  • 5
  • 1
    Ir's ALL conda related. If there is nothing else in the file, just delete `.bash_profile`, otherwise, delete all the lines you show above. – David C. Rankin Apr 02 '22 at 04:58

1 Answers1

2

The conda init command adds these lines. If you haven't yet uninstalled the conda command, then one could use

conda init --reverse

which should delete whatever lines it had added to the .bash_profile or other resource files. These files are loaded by shells upon initialization whenever an interactive (e.g., bash -i) or login (e.g., bash -l) session is launched. Advanced users use these files to customize their interactive shell sessions with things like aliases, PATH and PS1 customizations, and specialized functions (sounds like OP does not have such customizations defined).

If the only thing in the file is what is between the lines:

# >>> conda initialize >>>
...
# <<< conda initialize <<<

then one can safely delete the file altogether.

merv
  • 67,214
  • 13
  • 180
  • 245