1

I've some question about uninstalling Anaconda from macOS Big Sur. I was wondering if someone can please help me figure it our what to do. I followed the instruction on the official website (https://docs.anaconda.com/anaconda/install/uninstall/) plus some other guides, but I'm note an expert and I didn't reach my goal. That's what I did:

1) conda install anaconda-clean
2) anaconda-clean --yes
3) rm -rf ~/.condarc ~/.conda ~/.continuum
4) rm -rf ~/anaconda
5) conda remove -n myenv scipy
                         *PackagesNotFoundError
6) conda remove scipy
7) conda remove scipy curl
                         *PackagesNotFoundError
8) rm -rf ~/anaconda3
9) rm -rf ~/.anaconda_backup
10) export PATH=”/Users/MYUSERNAME/anaconda3/bin:$PATH
  1. At the end I've deleted the application throwing it in the trash and emptying it.

I'm not sure I did the right steps, maybe you can give me some advice. However, I didn't delete everything because I have still a folder in /opt path, /opt/anaconda3. I'm sure another folder was in /user/MYNAME, but I think I've deleted it, because I can't see it anymore, even in the hidden folders.

Then, if I run

conda list

lots of other packages are still available:

# packages in environment at /opt/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py37_0  
anaconda-clean            1.1.0            py37hecd8cb5_1  
anaconda-client           1.7.2                    py37_0  
[...] 
zlib                      1.2.11               h1de35cc_3  
zstd                      1.4.5                h41d2c2f_0

Also, conda still run in my terminal as I see (base) every time I open it, here an example:

(base) MYUSERNAME@MacBook ~ %

I also post the content inside .bash_profil, because maybe It can be related with "my terminal (base) problem":

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' '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 <<<

I just wanted delete all the packages and files related to Anaconda.

Thanks in advance

4
  • We can which anadonda (or type anaconda, or maybe something else for zsh) and it will tell us where the command is. It is strange that you kept anaconda3/bin in your path at step #10. /opt is also used by macPorts... maybe it was installed that way? We could spotlight search for anaconda and then do "Show all files..." to try to find left-overs. There's also a third-party application 'Find Any File' which searches for file names and other attributes. Applications store their files under Documents, Library, and Library/Application Support.
    – aMike
    Mar 27, 2021 at 13:33
  • I’m going to answer, just let it be. Unless you have a backup from before you installed this and it was only installed briefly, we would need to review every single thing you did to get the tool installed to answer this. Worse, if you run a correct command twice, you will get errors, they interact and you can’t delete a file twice.
    – bmike
    Mar 27, 2021 at 14:08
  • I guess your shell is ‘/bin/zsh’. Could you confirm I am right? If it is the case, then check for the modified by anaconda parts of ~/.zsh_profile and insert in your question.
    – dan
    Sep 29, 2021 at 5:57
  • 1
    For your own protection, don’t follow recipes or shell scripts you don’t understand. You can cause huge damage to your environnement with a single character in a command like rm -rf /opt/anaconda3 ( for example a single [space] after the first [/] ).
    – dan
    Sep 29, 2021 at 6:04

2 Answers 2

1

The issue is that the uninstall instructions assume that you have installed anaconda for just yourself however you have installed it for all users of the machine.

The installation put it in /opt/anaconda but the uninstall instructions assume you place it is ~/anaconda

The uninstall for a single user only needs the first 4 steps (and possibly 3 is not required as 2 does that) and a step to alter your shell startup files

But step 4 has to use the directory you installed anaconda in which is not always ~/anaconda. In your case /opt/anaconda You can find out the correct path by running conda info before starting to remove things The entry for base environment shows you the directory to remove.

To remove the entries from your shell first note that your step 10 is NOT what the uninstall doc says. The doc says look for a line like that and then edit to remove it. However for more confusion the doc does not cover the normal new updates to .bash_profile . You have to remove the section starting with # >>> conda initialize >>> and ending with # <<< conda initialize <<<

So I think (I have not tested as I need conda) the steps are

  1. Run conda info and note the base environment
  2. conda install anaconda-clean
  3. anaconda-clean --yes
  4. rm -rf ~/.condarc ~/.conda # I think 3 might do this
  5. rm -rf <the value found in step 1>
  6. Edit your shell startup files to both remove any entry altering your path for conda and also the parts in the conda initialise section
  7. When you have tested all remove the backup directory shown in the doc
0

This is a specific example of a common problem. Installers and applications that spray files and detritus all over the filesystem and rely on users to run many scripts, all changing weekly with version upgrades quickly becomes an intractable problem. You should be able to reclaim the 5 GB of space easily without worrying about some stub files and mostly empty config files.

Open the Terminal.app or iTerm2 terminal application, and then remove your entire Anaconda directory, which has a name such as anaconda2, anaconda3, or ~/opt. Enter rm -rf ~/anaconda3 to remove the directory.

If you’ve deleted the main program and the main folders (which I repeat above), I would say you’re good. Set up Time Machine so you’re backing up going forward and next time you want to install similar tool chains and environments, be sure you have a backup so you can roll back if that install gives poor results. Unless there’s a large file lying around you won’t gain anything cleaning up hundreds of files and other tools let you find folders and large files to clean them together.


In the unlikely event you have some issue caused by the leftover files, it’s less complicated and less time consuming to erase and reinstall a Mac and get your documents and apps reinstalled than it is to reconstruct what anaconda installed and surgically reverse every remnant left on the filesystem.

Worse, if you rm the wrong thing, you may delete more than you bargained for.

A safer bet is to substitute open for rm and you do need to recognize -rf or any flags passed to rm and delete them. Use the command line to open the folders rather than removing them is my advice if you don’t get exactly the syntax of the commands you are copy and paste into terminal. The writer of those guides assumes you know what the commands do or you won’t blame / sue them if you make an error and delete your home folder and all your pictures and documents.

2
  • Thank you for your help @bmike . I tried to run rm -rfi ~/opt but it seems no folder exist. Do I digit the wrong path for the opt folder? I don't understand what ~ is for the path. I can see a folder in .opt/anaconda3 . Also, following the anaconda website, I installed anaconda-clean but seems it didn't do much. Unfortunately, the most annoying problem is conda running in the terminal, as I can see (base) in any terminal session. .bash_profil contain the script I found in, with references to conda.
    – user412503
    Mar 27, 2021 at 14:36
  • See, I would not delete things in general @Andrea wait to determine that folder even takes enough space. The harm in deleting too much is too high. Don’t rm is my advice. Instead use open and have Finder show you what you have and drag the files to trash. You likely broke anaconda clean by trying other uninstall steps out of sequence (or just had a broken / incomplete installation in the first place).
    – bmike
    Mar 27, 2021 at 14:38

You must log in to answer this question.