How to Completely Uninstall Anaconda from macOS: A Step-by-Step Guide

Anaconda is a popular distribution of Python and R programming languages for scientific computing, that aims to simplify package management and deployment. However, there may come a time when you need to uninstall it from your macOS, whether for troubleshooting, to reinstall a fresh version, or simply to free up space. Removing Anaconda can seem daunting, but with the right steps, it's a straightforward process.

Step 1: Removing Anaconda Directory

First, you need to remove the Anaconda directory. This can be done by using the Terminal. Open your Terminal and run the following command:

rm -rf ~/anaconda3

Replace anaconda3 with anaconda2 if you have that version. This command forcefully removes the entire Anaconda directory.

Step 2: Cleaning Up

After deleting the Anaconda directory, you should remove any references to Anaconda in your bash profile. These references are used to add Anaconda to your PATH, which allows you to run Anaconda from your Terminal.

Open your .bash_profile or .zshrc file in a text editor. If you're using the default Terminal, you can open it with:

open ~/.bash_profile

Or, if you're using Zsh (the default shell in newer versions of macOS), use:

open ~/.zshrc

Look for lines that reference anaconda3 or anaconda2 and delete them. These lines might look something like this:

export PATH="/Users/yourusername/anaconda3/bin:$PATH"

Save the file and close the text editor.

Step 3: Removing Hidden Files and Directories

Anaconda also creates hidden files and directories that need to be removed. You can find and remove them by running:

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

These commands remove the .conda directory, the .condarc configuration file, and the .continuum directory, which are all used by Anaconda.

Step 4: Verify Uninstallation

To ensure that Anaconda is completely uninstalled, you can try running:

conda info

If you've successfully removed Anaconda, you'll see an error message saying something like "command not found: conda". This indicates that the Anaconda commands are no longer accessible, confirming that Anaconda has been removed from your system.

Conclusion

Uninstalling Anaconda from your macOS is a process that involves removing the Anaconda directory, cleaning up your bash or zsh profile, and deleting any hidden files created by Anaconda. By following these steps, you can ensure a complete removal of Anaconda from your system. Whether you're looking to reinstall Anaconda or simply want to clean up your system, these steps will help you achieve your goal efficiently.