26 January 2021
Anaconda is an open-source distribution platform for Python and R programming languages with over 20 million users worldwide.
The best way to remove Anaconda is to use the terminal. First, you need to install the Anaconda-clean package and use it to clean all the Anaconda related files and directories. Then we need to remove the whole anaconda3 / anaconda2 directory.
However, removing the Anaconda directory using the Anaconda-clean package won't uninstall Anaconda completely. You'll also need to remove the Anaconda path from .bash_profile in order to fully uninstall.
Now you might have a rough idea about the uninstallation process. Now let's dive through the step by step process!
1. Open the Terminal and press command + space at once to bring up the Spotlight search.
2. Search for 'Terminal' and open it. Now you'll get a fresh Terminal window on your screen.
3. Type the following command, and execute it to install the Anaconda-clean package:
4. You might be asked to verify the process. Type 'y' and press the return key.
Step 1. We are going to remove all the files and directories related to Anaconda using Anaconda-clean. You can continue this step in two ways. You can delete each one of the files and directories by confirming the deletion one by one or you can remove all the files and directories at once.
If you want to delete these files and directories one by one, after reviewing and confirming, type the following command in the Terminal and execute:
However, If you want to delete all the files at once without reviewing and confirming, type the following command in the Terminal and execute:
I'll proceed with the second step (without reviewing and confirming each file):
As shown above, this command will generate a backup Anaconda directory named 'anaconda_backup' of cleaned files and directories.
Step 2. You should delete the 'anaconda_backup' folder which was generated from the previous step. In order to do that, type the following command and press the return key. You will need to provide the password of your Macbook.
Step 3. Now, you need to remove the Anaconda directory from the "opt" directory by following the steps below:
NOTE: If your directory's name is "anaconda2" use sudo rm -rf anaconda2 command.
You will need to provide your Macbook's password as shown below:
As the last step of this anaconda uninstallation process, you need to remove the path from the '.bash_profile'. Let's see how to do it.
1. First, you need to navigate to your home directory using cd ~ command.
2. Then type nano ./.bash_profile to access and open the '.bash_profile' file as shown below:
3. You will see a variable similar to the above one. Remove it and press Control+O together to write out the file. Then press Control+X to exit from the '.bash_profile' file.
4. Finally, type sudo ./.bash_profile and press the return key. You'll be asked to provide your MacBook's password to complete this step. Provide it and press the return key.
That's it, now you know how to completely uninstall Anaconda from your macOS. We have a full repository of tutorials on Mac software. We are looking for more suggestions/topics from you.