Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

oooopossum

macrumors member
Original poster
Apr 21, 2021
43
55
Miami
Screen Shot 2021-07-25 at 2.17.38 AM.png

Hi there. I was hoping I could resolve this issue with a quick google search but that was lead me down a whole rabbit hole thats led to nothing but frustration. Recently, I emptied my trashcan and it said it could not delete one file because it was still in use. I then closed all applications on my Mac, and even confirmed so in the Activity Monitor that it or similar processes were running. It still refused to be deleted. Here is what I have tried:
  • Sudo rm and all its related commands in Terminal
    • It says that its a directory, and fails to remove it. rmdir fails as well, saying it's not empty. But it is... (see below)
  • Using Cleaning/ Deletion apps such as CleanMyMac and OnyX
    • Both are able to delete seemingly everything BUT this file. Both have Full Disk Access
  • "Delete Immediately"
    • Gives the error in the attached image
  • Confirming it is not locked in Get info, and I have correct/ necessary permissions to delete/ edit it.
  • All the mentioned above, but in Safe Boot/Mode
The file is an older version of Xcode, or at least it was. Get info says its Zero KB and empty, so I'm not sure what to do at this point. Nothing on google (that I've found) has worked for me, hence why I am here.
 

pippox0

macrumors regular
Jan 23, 2014
134
93
Check disk and permissione with disk utility , then open terminal and delete it
 

Slartibart

macrumors 68040
Aug 19, 2020
3,140
2,815
Right click the icon and “put it back”. Then change in the Terminal to the folder containing that XCode app.

Try

sudo rm -rf ./XCode.app

in the terminal. If there is a problem with the read/write permissions run

sudo chmod -R 777

before.

nota bene: if you choose “Secure Empty Trash” in the Finder it might simply delete it from the trash can (depends on MacOS version, YMMV)
 

oooopossum

macrumors member
Original poster
Apr 21, 2021
43
55
Miami
Right click the icon and “put it back”. Then change in the Terminal to the folder containing that XCode app.

Try

sudo rm -rf ./XCode.app

in the terminal. If there is a problem with the read/write permissions run

sudo chmod -R 777

before.

nota bene: if you choose “Secure Empty Trash” in the Finder it might simply delete it from the trash can (depends on MacOS version, YMMV)
Hi there. I appreciate your reply, truly. I have tried removing the file in various locations that aren't the trash can (Desktop, a folder, documents, etc) and they all provide the same error messages (no matter the method) as stated in my original post. As for the permissions, they're all correct. And for the "Secure Empty Trash", I am on Catalina, so that appears to no longer be an option. If there are any other methods I can try let me know.
 

Slartibart

macrumors 68040
Aug 19, 2020
3,140
2,815
In the terminal cd to the folder with the program corpse

Use

$ find . -flags uchg -exec chflags nouchg {} \;

to unlock any file within the folder
 

auxbuss

macrumors 6502
Feb 18, 2014
452
329
UK
Have you tried deleting it in Recovery Mode?

(Mount the disk using Disk Utiliy, close Disk Utility, open terminal, cd to /Volumes/<your machine name>/Users/<username>/.Trash, delete away.)
 

oooopossum

macrumors member
Original poster
Apr 21, 2021
43
55
Miami
In the terminal cd to the folder with the program corpse

Use

$ find . -flags uchg -exec chflags nouchg {} \;

to unlock any file within the folder
I did this, as well as doing it in sudo, to no avail. Same error.

PS - Program corpse seems to describe the file perfectly lol
 

oooopossum

macrumors member
Original poster
Apr 21, 2021
43
55
Miami
Have you tried deleting it in Recovery Mode?

(Mount the disk using Disk Utiliy, close Disk Utility, open terminal, cd to /Volumes/<your machine name>/Users/<username>/.Trash, delete away.)
Yes, as well as in safe boot. No success. Same error messages
 

auxbuss

macrumors 6502
Feb 18, 2014
452
329
UK
Yes, as well as in safe boot. No success. Same error messages
I doubt Safe Mode is any use here.

Can you provide the output from ls -laR .Trash

Also, in Recovery Mode, post the actual error message from the command line. If it's "rmdir: .Trash/Xcode: Directory not empty", then try rm -r .Trash/Xcode – no f option, which will swallow error messages. Please provide any error message.
 
  • Like
Reactions: Slartibart

oooopossum

macrumors member
Original poster
Apr 21, 2021
43
55
Miami
I doubt Safe Mode is any use here.

Can you provide the output from ls -laR .Trash

Also, in Recovery Mode, post the actual error message from the command line. If it's "rmdir: .Trash/Xcode: Directory not empty", then try rm -r .Trash/Xcode – no f option, which will swallow error messages. Please provide any error message.
Sure thing.

When I do rm or rmdir with (any of the flags):
rm.png
When I do ls:
ls.png

This is what's so confusing to me. Some things say its empty and basically nothing (rm, rmdir, get info). But others things like this point to it not being empty.
 

iGeneo

macrumors demi-god
Jul 3, 2010
1,474
2,758
Did you ever find a resolution? I have a folder there that is doing the same. Empty trash says "The operation can’t be completed because the item “Application Support” is in use"

The folder is empty, permissions are R&W for everyone. Cannot drag it out "The operation can’t be completed because you don’t have permission to access some of the items"

Help!!!
 

Slartibart

macrumors 68040
Aug 19, 2020
3,140
2,815
Did you ever find a resolution? I have a folder there that is doing the same. Empty trash says "The operation can’t be completed because the item “Application Support” is in use"

The folder is empty, permissions are R&W for everyone. Cannot drag it out "The operation can’t be completed because you don’t have permission to access some of the items"

Help!!!
Try to “secure delete” the trash can:

  • On the keyboard, hold down the ‘Control’ key.
  • Click on the ‘Trash’ icon.
  • Press “Command” on OS X Yosemite/higher. You can press “Control” or “Option” instead.
  • Click the “Secure Empty Trash”.
This will take some time.
 

iGeneo

macrumors demi-god
Jul 3, 2010
1,474
2,758
Try to “secure delete” the trash can:

  • On the keyboard, hold down the ‘Control’ key.
  • Click on the ‘Trash’ icon.
  • Press “Command” on OS X Yosemite/higher. You can press “Control” or “Option” instead.
  • Click the “Secure Empty Trash”.
This will take some time.
thanks... step 3 does nothing (Monterey)
 

iGeneo

macrumors demi-god
Jul 3, 2010
1,474
2,758
Not seeing any option for secure delete. Opening the trash and right clicking I get these three errors (The DELETE ME folder shows no contents)
Screen Shot 2022-01-01 at 12.10.55.png
Screen Shot 2022-01-01 at 12.10.40.png
Screen Shot 2022-01-01 at 12.11.03.png
 

oooopossum

macrumors member
Original poster
Apr 21, 2021
43
55
Miami
  • Like
Reactions: iGeneo

iGeneo

macrumors demi-god
Jul 3, 2010
1,474
2,758
Hi friend! I never found a "solution" per se. I completely reinstalled MacOS on a new SSD to fix the problem. Sorry if that doesn't help. I truly tried everything and nothing but the nuclear option worked
I’m thinking the same. or maybe making a new admin user? Then nuke the current user? Any thoughts on that?
 

oooopossum

macrumors member
Original poster
Apr 21, 2021
43
55
Miami
I’m thinking the same. or maybe making a new admin user? Then nuke the current user? Any thoughts on that?
I did not try that so I cannot attest to it, however that could work if you don't mind the hassle of doing so. Backup your files
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.