Sunday, July 28, 2013

Can't Empty Trash Error Code -8003

Several times now I've installed Box.com's BoxSync app only to find out after it's installed that I cannot empty the trash. I use Box.com a lot for clients and turns out they're using it more and more but Box.com's installer needs some work and I've emailed them a few times to let them know with not results.

What happens is you install the app, toss the installer into the trash and hit Empty Trash or your favorite key combo (mine is COMMAND + SHIFT + OPTION +DELETE) and the Mac yells at you about how it can't do that and tosses up an error code of -8003.

Rebooting then emptying the trash doesn't help.
Holding down option when you empty trash (see key combo above) doesn't work.
Trying to securely empty trash doesn't work.

What I've had to do a handful of times now on different Macs with different versions of the OS installed to delete BoxSync (this applies to anything that refuses to be deleted) is this:

1. Launch the Terminal
2. Type EXACTLY and without quotes "cd .Trash" hit return.
3. Type EXACTLY and without quotes "ls -al" hit return and see all the stuff that's in the trash.
4. After you confirm what you want to delete is in the trash type EXACTLY and without quotes "rm " that's lower case rm and a space(bar), then type the first letter, paying attention to capitalization of the file and tap TAB to auto complete it. This is for FILES not folders or packages!
5. Hit return and it should be gone.

If it's a package like Box Sync Installer is then step 4 is slightly different. Type EXACTLY and without quotes "rm -rf " thats lower case rm a space(bar) a dash and lower case rf then another space(bar). Then type a capital B and tap TAB to auto complete it. It should look like this:

rm - rf Box\ Sync\ Installer.app/

Hit return and it should be gone. Finally.

TECHNICAL STUFF:

If you really want to find the offending file and don't have a ton of stuff in the trash you can move items back where they were, meaning back on the same volume, drive, folder or whatever, just not in the Trash. I put stuff from one drive into a new temp folder I name "TRASH THIS!" so they're not loose all over the place on that drive.

Then put them in the trash and delete them one by one. Eventually you'll hit a folder or file that won't delete. Recently I had a file that was actually a package that wouldn't delete and tossed up the -8003 error.

Here's what I did once I found the file that refused to be deleted.

- Launch the Terminal

- Type "cd" space-bar then drag the folder that has that file into the terminal, it'll fill out the path then hit Return.

- Type "ls -al" to list the files. (If you want to get fancy type "ls -FaGlh" for a nicer looking file list in the Terminal)

- Type this EXACTLY, "rm" space-bar, then the first letter of the file that won't delete, then the Tab key. Hitting the Tab key will fill out the rest of the file name saving you from typing or worse, mistyping it.

EXAMPLE:

If the file is called roughcut.mov type "rm" hit the spacebar and type "r" then Tab key. The Terminal will show something like:

rm folder/roughcut.mov

Hit Return and it should delete the file.

If it's a folder, from inside the folder that folder is in (see "cd" above) it's in, add a -rvf to the command. This will show you all the things it's deleting.

-r will delete folders and their contents
-v shows you all the stuff it's deleting
-f tells the rm command to ignore files that aren't really there

If you want to confirm every file before it's deleted I think you can add an "i" to the string of switches like "-rvfi"

Careful with all this, using the rm command can seriously ruin your day if you're not careful. To read more about rm type this into the Terminal and hit enter:

man rm