DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Forums
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OS X | UNIX

back

Unix

Mac OS X How To

by Adrian Mayo - Senior Editor for Mac OS X Unix

How To Fix Stubborn Trash and Why it Won't Delete (page 1 of 2)

The Problem

Many questions posed on the OSXFAQ forums relate to trash that cannot be emptied using the regular 'Empty Trash' operation. There are many reasons why this happens: sometimes the user does not have sufficient privileges to delete items; sometimes items are locked; sometimes items are in use. Whatever the reason, the Finder displays a yellow warning triangle and stubbornly refuses to do as it's told.

Naturally, if you say to empty the trash, you want it emptied.

There is no one specific cause to this mutinous behaviour, and therefore no specific solution can be given. Instead, I will explain how the trash is implemented in Mac OS X, and present an arsenal of techniques one can employ to manually delete it. Short of a corrupt file system the trash can always be deleted.

I will consider both Mac OS X GUI and Mac OS X Command Line (Unix) approaches, with the latter including a detailed explanation of how trash is implemented. Of course, you could boot into OS 9 and use your OS 9 skills and tools too.

Prerequisites

A little understanding of the Unix permissions will help, but is not necessary. Read 'Users, Groups, and Permissions' from the Advanced Mac OS X Unix section of the Learning Center.

If you are not comfortable using the Terminal to issue Unix commands, read the Mac OS X Unix Tutorial .

Trash Me Quick

The links below take you straight to instructions for trashing the untrashable, skipping the waffle for those in a hurry:

For the simplest of the GUI methods use SuperGetInfo or BatChmod

For the all-powerful Unix method use 'sudo rm'

 
Tell Me More...

But it's MY Computer!

You may think that you own your computer, but in reality the user 'root' owns it. Every user (admin or staff) is subject to the permissions applied to each file in the file system. That is except 'root'. Mr root is above permissions and has the freedom to run amuck.

That's the power of root, allowing one to do such things as empty the trash when normal methods fail.

It's also the danger of root. Be careful when you issue commands as root, otherwise you may loose all your precious files, or even hose your Mac OS X installation.

Be warned! Be careful!


The GUI Approach

When the empty trash operation fails, the Finder may report either insufficient privileges, or items in use. The different circumstances require different approaches.

How to Delete (Insufficient Privileges)

If the Finder reports:

'The operation cannot be completed because you don't have sufficient privileges for dah-di-dah'

hit continue to remove as much as possible.

Now, select the first weapon of trash destruction to unlock the item.

Weapon 1 - Manual Unlocking

Some items in the trash may be locked: although locked items are usually unlocked and removed automatically, in some cases they are not. Open the trash and examine the remaining items, particularly 'dah-di-dah'. Select each item in turn, hitting command-I to open the Finder's 'Show Info' window. Select 'General Information' from the pop-up menu. In the lower left corner you will notice a checkbox called 'Locked'. If this is checked, uncheck it by clicking the box.

You may not be able to unlock an item if you do not own it, so move on and select weapon 2.

If you were able to unlock all items try to empty the trash again, and repeat until you win, or you have to admit defeat.


Where's it Hiding?

You won't see the Trash when browsing directories in the Finder.

It's hidden from you - one of those parts of the system that the Finder likes to keep to itself. The trash is actually in your home directory in a folder called '.Trash'. The Finder does not display files that start with a dot.

So Many Doors!

Unlocking is tedious when many items remain in the trash, which is where the command line comes into its own. A single Unix command can unlock every locked item in the trash. See 'The Command Line Approach'.


terminal


Weapon 2 - 3rd Party Super-Trashers

Many 3rd party applications are available to help you manage permissions. These often have an 'Empty Trash' option too. Three of the more popular are:

Super Get Info

BatChmod

fileXaminer

In either of these, select the empty trash option.

How to Delete (Items in Use)

If the Finder reports:

'The operation could not be completed because the item dah-di-dah is in use'

then hit continue to remove as much as possible.

Now select weapon 3 to close the item.

Weapon 3 - Closing Items

An item that is in use has been opened by some application which has not yet closed it. From the item name you may be able to guess which application is the culprit. Quit that application and try again.

Sometimes the Finder is behind the times, and may think a file is locked when it no longer is. Moving the offending file from the trash then back in again may work.

If you are not successful, quit more applications. If that fails try logging out and back in again. Finally, a re-boot will ensure no items remain in use.

It is possible to have both permission problems and items in use, so you must employ both of the above techniques.

 
Tell Me More...

Danger! Danger!

I am wary of GUI applications that allow you to change privileges over and above what the Finder allows. If you are asked for your Admin password, the application will be doing its deeds as the root user, giving you great power to detrimentally affect your OS X installation. In fact, it gives you the power to completely hose it. You must understand what you are doing.

The empty trash option of such programs should be safe to use.

Login Items

Remember, when you log in some applications are automatically started. These can be temporarily prevented from starting by holding down the shift key when logging in.


Next Page

Now we now know how to tackle trash problems the GUI way. Next, I will explain how Mac OS X implements the trash behind the scenes, and how you can delete it the Unix way.



How To Fix Stubborn Trash and Why it Won't Delete (page 1 of 2)

next

Copyright © 2000-2008 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.