How to Safely Uninstall Anaconda From a Mac


Uninstalling Anaconda from your Mac isn’t as straightforward as you’d think, but we’ll teach you how to remove it and its leftover files thoroughly.

Getting rid of Anaconda on a Mac isn’t a straightforward process. Although you can drag the Anaconda Navigator—the GUI of the Anaconda distribution—into the Trash, that won’t delete Anaconda-related files, directories, and command-line integrations.

Instead, you must run a series of commands via Terminal to uninstall Anaconda completely from macOS. This Anaconda removal tutorial for the Mac will walk you through the entire procedure.

Install and Run the Anaconda Clean Package

Anaconda offers a cleanup package capable of removing all configuration files related to the distribution. You must install and run it through the Terminal app on your Mac. To do that, follow these steps:

  1. Open the Launchpad and select Other > Terminal.
  2. Type the following command and press Return to install the cleanup package:
    conda install anaconda-clean
  3. Execute the command below to initiate the package. The variable at the end allows you to skip confirming each file and folder the Anaconda cleaner deletes.
    anaconda-clean --yes

Run the Anaconda cleaner via the Mac Terminal.

Delete the Anaconda Directory and Backups

After running the Anaconda cleaner, you must delete Anaconda’s installation directory. Again, Terminal should help you with that:

rm -rf ~/opt/anaconda3

The command above assumes you’re running Anaconda3 and that the installation is within the Opt folder of your Mac user account.

Optionally, if you don’t have much storage space on your Mac, consider deleting the Anaconda backup folder using the following command:

rm -rf ~/.anaconda_backup

Delete the Anaconda PATH Variable

With Anaconda uninstalled, you must remove the distribution from the Terminal’s Bash profile using TextEdit. Here’s how:

  1. Execute the following command in Terminal to open the Bash profile in TextEdit.
    open .bash_profile
  2. Delete the following line:
    export PATH="/Users/[your username]/anaconda3/bin:$PATH"
  3. Select File > Save from the macOS menu bar.

Removing the Anaconda PATH variable in the Bash profile.

Delete Anaconda Leftovers Manually

If you want to be thorough, you can remove Anaconda leftovers manually from various locations on your Mac. To do that, open Finder, select Go > Go to Folder from the menu bar, and visit the following directories:

  • ~/Library/Receipts
  • ~/Library/Caches
  • ~/Library/Preferences
  • ~/Library/Containers
  • ~/Library/Application Support
  • ~/Library/Application Scripts
  • ~/Library/Logs

Search for files that end with the words “Anaconda” and “conda” inside each directory and move them into the Mac’s Trash.

Anaconda Safely Uninstalled From Your Mac

Uninstalling Anaconda from your Mac isn’t complicated if you follow the proper steps. Removing it not only declutters your system but also frees up valuable storage space and eliminates potential conflicts with other Python installations.


Source link

Leave a Reply

%d bloggers like this: