The way to uninstall Miniconda

2024-02-19
2022-08-15

I tried to uninstall Miniconda 3 and reinstall it with pyenv, but I failed because some configuration remained.

Delete the directory

Show the path of the virtual environment with the below command:

terminal

$ conda env list
# conda environments:
#
base         *  /Users/[user]/opt/anaconda3

Delete the directory for Miniconda.

terminal

$ rm -rf ~/opt/miniconda3

Delete the configuration

Delete the configuration .bash_profile and .zshrc from when installed.

terminal

$ nano ~/.zshrc

The configuration to delete is surrounded by the commented out messages.

.zshrc

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

terminal

$ rm -rf ~/.condarc ~/.conda ~/.continuum

Delete the environment variables

terminal

$ env | grep CONDA
CONDA_EXE=/Users/[user]/opt/miniconda3/bin/conda
_CE_CONDA=
CONDA_PYTHON_EXE=/Users/[user]/opt/miniconda3/bin/python
CONDA_SHLVL=3
CONDA_PREFIX=/Users/[user]/opt/miniconda3/envs/[environment]
CONDA_DEFAULT_EXE=[environment]
CONDA_PROMPT_MODIFIER=([environment])
CONDA_PREFIX_1=/Users/[user]/anaconda3
CONDA_PREFIX_1=/Users/[user]/opt/miniconda3

If these variables remain, you will fail to reinstall. Delete the variables with the below command:

terminal

$ unset CONDA_XXX

Next step:

https://blog.mktia.com/build-failed-when-pyenv-install-on-mac