Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Cannot empty trash of a stubborn item

Cannot empty trash of a stubborn item.


My trash is completely empty except for a folder “MSU” that contains another folder “Acute calcific periarthritis” that contains an image “1009964.jpg”.


First, the basics: “Finder>Empty Trash”:


“The operation can’t be completed because an unexpected error occurred (error code -50).”

Continue

“The operation can’t be completed because an unexpected error occurred (error code -50).”

Continue

“The operation can’t be completed because the item “MSU” is in use.


So then I try the terminal:


[mycomputername:~] myusername% sudo rm -R /Users/myusername/.Trash/MSU

rm: /Users/myusername/.Trash/MSU/Acute calcific periarthritis/1009964.jpg: Invalid argument

rm: /Users/myusername/.Trash/MSU/Acute calcific periarthritis: Invalid argument

rm: /Users/myusername/.Trash/MSU: Directory not empty


Guessing the problem is the weird character at the end of the name of the folder, “Acute calcific periarthritis” I try to rename that folder “xxx”.

“The name “xxx” can’t be used. Try using a name with fewer characters, or with no punctuation marks.


I guess one option is to just leave this single folder “MSU” in my trash can forever, with its contained folder “Acute calcific periarthritis” and thats contained 100kb image “1009964.jpg”.


But it’s kind of irritating and I’d like to learn how to fix this.


Any thoughts would be greatly appreciated! Thank you very much.


PS I’ve totally restarted my 10.11.6 iMac Late 2014 multiple times and retried the above to no avail.

OS X El Capitan (10.11.6)

Posted on Apr 2, 2017 7:13 AM

Reply
Question marked as Best reply

Posted on Apr 9, 2017 3:58 AM

Your Late-2014 iMac was sold by Apple from 2014-10-16 through 2015-10-13. It originally shipped with Yosemite pre-installed. If you never separately downloaded Yosemite from the Mac App Store prior to the release of El Capitan in Fall 2015, then the full Yosemite installer is no longer available to you for download (or Apple purchase), and you will not be able to remove that nul-byte containing filename without Yosemite.


Your options in practical priority:

  1. You know a trustworthy person that has a bootable, Yosemite USB Stick made from a legitimate Yosemite installer download from the Apple Store. You are not going to install Yosemite, just get at its Utilities menu from the boot screen, choose Terminal, and then navigate to your home directory's .Trash folder as I mentioned previously. Once the file is removed, you boot normally back into El Capitan.
  2. Check with the closest Apple retail store to determine if they can do one of the following at the Genius bar (appointment):
    1. Make a bootable Yosemite USB stick for you.
    2. Boot your iMac with Yosemite at the Apple Store, if you lug it in to them, and then remove the nul-byte file there.
    3. Migrate your old account and files (without its .Trash file) to a new administrator account.

      Perform full backup of the new account. Your old Time Machine backups will no longer match the new user ID, and restoring from them will require manual dexterity in the Terminal.

17 replies
Question marked as Best reply

Apr 9, 2017 3:58 AM in response to CharPatton

Your Late-2014 iMac was sold by Apple from 2014-10-16 through 2015-10-13. It originally shipped with Yosemite pre-installed. If you never separately downloaded Yosemite from the Mac App Store prior to the release of El Capitan in Fall 2015, then the full Yosemite installer is no longer available to you for download (or Apple purchase), and you will not be able to remove that nul-byte containing filename without Yosemite.


Your options in practical priority:

  1. You know a trustworthy person that has a bootable, Yosemite USB Stick made from a legitimate Yosemite installer download from the Apple Store. You are not going to install Yosemite, just get at its Utilities menu from the boot screen, choose Terminal, and then navigate to your home directory's .Trash folder as I mentioned previously. Once the file is removed, you boot normally back into El Capitan.
  2. Check with the closest Apple retail store to determine if they can do one of the following at the Genius bar (appointment):
    1. Make a bootable Yosemite USB stick for you.
    2. Boot your iMac with Yosemite at the Apple Store, if you lug it in to them, and then remove the nul-byte file there.
    3. Migrate your old account and files (without its .Trash file) to a new administrator account.

      Perform full backup of the new account. Your old Time Machine backups will no longer match the new user ID, and restoring from them will require manual dexterity in the Terminal.

May 6, 2017 12:32 PM in response to CharPatton

Here's where I am stuck at.


I boot from the Yosemite USB and see -bash-3.2#


I run /sbin/fsck -fy and it runs appropriately and says there are no errors.


/sbin/mount -uw / runs OK without errors, but when I run ls /Users it says there is no folder like Users or something like that.


I run cd .. several times to try and get to the top of the stack and see:


User uploaded file


I then run cd Volumes to look in there and see:


User uploaded file


So the question is, how does one navigate to your own user folder from "-bash-3.2#" ??? I'm totally befuddled.


If it helps, there are 3 startup disks listed: "Untitled Windows", "OS X Yosemite..." (the Yosemite USB stick purchased discussed above) and "MyComputer Encrypted Disk" (I am assuming it is saying Encrypted Disk since FileVault is enabled).


Much appreciated.

Apr 2, 2017 7:34 AM in response to CharPatton

Have you tried holding the Option key to Secure Empty? If that doesn't work try the steps in this Apple Support Topic:

You can't empty the Trash or move a file to the Trash - Apple Support

Try Trash It:

http://nonamescriptware.com/downloads/

Of course there is always the nuclear option of rebuilding the Trash in Terminal with the command:

sudo rm -rf ~/.Trash*

Apr 2, 2017 9:12 AM in response to macjack

Great tips. Thank you!


1) Tried the option key and same unsuccessful result.


2) Was intrigued by this text in your link since in my ignorance I think this is where the problem lies:


Does the file or volume have special characters?
Usually, Mac OS X can delete files whose names contain special characters, but sometimes you might need to follow this advice.

  1. Note the name of the volume which the files are being deleted from. If you are not sure of the item's location, you can verify that by selecting it then choosing Show Info from the File menu. If the name of the volume contains any special ASCII characters, such as a bullet or trademark character, temporarily rename the volume so that it does not contain these characters.
    Example: If you cannot delete files from a volume named "·Dox", rename the volume to "Dox". After the Trash is empty, restore the volume's original name as desired.
  2. Examine the name of the files or folders you cannot delete. They should not contain a solidus ("slash", "/") character or any other special ASCII character such as a trademark, quotation mark, or copyright symbol. If the file does, remove the special character or slash from its name, then delete it.
    Example: If you cannot delete a file named "Things/stuff", rename the file to just "t", then delete it.

But even under Get Info it still doesn't let me change the name- I get the same error message as when I try and change the name in Finder.


3) Tried the nuclear option and unfortunately this still doesn't work:


[mycomputername:~] myusername% sudo rm -rf ~/.Trash*

Password:

rm: /Users/myusername/.Trash/MSU/Acute calcific periarthritis/1009964.jpg: Invalid argument

rm: /Users/myusername/.Trash/MSU/Acute calcific periarthritis: Invalid argument

rm: /Users/myusername/.Trash/MSU: Directory not empty

rm: /Users/myusername/.Trash: Directory not empty

[tw-g4-home:~] myusername%


4) Tried the "Really Stuck" as well as usual options of TrashIt with no luck.


It seems like the weird character at the end of this phrase is causing the difficulty, but it's a Catch 22 since one cannot change nor delete this character for love nor money!!!

Apr 23, 2017 7:07 AM in response to VikingOSX

OK, got a great little USB with Yosemite on it from Amazon at https://www.amazon.com/dp/B00S4ZIO88/ref=cfb_at_prodpg


Then booted from it and opened terminal.


The command line prompt read: -bash-3.2# (means nothing to me!)


Did ls -l and it showed:

.forward Library


Did rm -rf /Users/UID/.Trash/MSU and nothing happened


Did cd /Users/UID/.Trash/MSU and it said "no such file or directory" or something like that.


So my questions are:

  1. How does one navigate to the Trash folder in my user account?
  2. Does having Fireguard turned on impede this in any way?


Again, thank you so much!!!

Apr 23, 2017 10:14 AM in response to CharPatton

You are sitting in Terminal from the Utilities menu after booting up in Yosemite. The “yourshortname” is your user name.

  • cd /Volumes/Macintosh\ HD/Users/yourshortname/.Trash
  • pwd

    Verify that you are in fact, in the .Trash folder in your home account

  • ls -l ./MSU

    check to see if the MSU folder is there.

  • rm -rf ./MSU

    remove the MSU folder and its contents

Apr 2, 2017 7:07 PM in response to macjack

Thanks again for taking the time to reply!


That's a great thought. The problem file/folder did indeed come from a disk image, so I was very hopeful with your suggestion. So I mounted that disk image, and now I have two copies of the problem file/folder in my trash 🙂


And trying to empty the trash gives the same set of problems as it tries to delete each of the two copies, again with no luck at the end of the day.


Looks like we found a real bug, and not sure how to fix it.

Apr 8, 2017 9:46 PM in response to CharPatton

Your white-space name, “Acute calcific periarthritis has a trailing nul byte in it. That nul character will prevent Finder, and all Terminal commands from removing the file in El Capitan. The only way to remove that particular file is to boot from a Yosemite (or earlier) USB stick, and use the Utilities : Terminal to navigate to the /Volumes/Macintosh\ HD/Users/yourhome/.Trash/MSU folder. Then, the UNIX command: rf -if will prompt you with the “Acute calcific periarthritis filename and you can remove it.

Apr 26, 2017 7:07 PM in response to VikingOSX

All always, thanks much for advice and guiding me through this!


I can't seem to get the terminal lines above to work, likely cuz I don't know the terminology.


You list:

cd /Volumes/Macintosh\ HD/Users/yourshortname/.Trash


But in terminal the terms used on my computer are: [text1:~] text2%


I'm assuming that "text2" goes into "yourshortname", but where do I put "text1"?


Also, is there a space between \ and HD in "Macintosh\ HD" above, or is this a mistake and there should be no space?


Much appreciated.

May 6, 2017 8:51 PM in response to CharPatton

Woo hoo/ Solved! Thanks to all for their help, especially Viking regarding the bootable, Yosemite USB Stick.


The final trick necessary was to decrypt the disk (i.e., turn off FileVault). Once that was done you could boot from the Yosemite USB stick, then use "cd .." and "ls" repeatedly to rise to the top level, then navigate back down to the now available (unencrypted) drive using cd "directory name" and finally get to .Trash. Once there the remove command worked like a charm.


This was a lot of work but fun learning stuff. Again, appreciate all who chimed in with hints!

Cannot empty trash of a stubborn item

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.