How to force remove a file on my disk with permissions I am unable to reset?

I downloaded anaconda and I accidentally started to download it onto my top-level directory, the disk itself, and I cannot remove it. I can't change the name, and when I change the permissions from read only to read and write for admin, everyone, and myself, it says I do not have permission to delete the folder. I'm also confused about why I'm not admin when I should be. Regardless, I've tried to force delete it and it's not working.

When I try to download it again, it says I can't download anaconda because the folder already exists, so I'm downloading python in the opt folder on my disk-utility and it's freezing. IDK what's wrong with this. Any help would be appreciated.


Solution 1:

I downloaded the install package from the site https://www.anaconda.com/products/individual and ran through a default install. It looks like the application is installed in /opt. You will need to use

sudo rm -rf /opt/anaconda3

to delete. Please review terminal session below:


(base) users-MacBook-Pro:~ user$ cd /opt

(base) users-MacBook-Pro:opt user$ ls -l
total 0
drwxr-xr-x  26 user  wheel  884  4 May 14:22 anaconda3

(base) users-MacBook-Pro:opt user$ rm -rf anaconda3
rm: anaconda3: Permission denied

(base) users-MacBook-Pro:opt user$ sudo rm -rf anaconda3
Password:

(base) users-MacBook-Pro:opt user$ ls -l
total 0