You are on page 1of 7

Solving Trash Problems

http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481

About

X-Books

X-FAQs

X-Services

X-Links

Support

1 of 7

9/24/08 1:35 PM

Solving Trash Problems

http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481

Solving Trash Problems


A variety of issues can result in making it difcult or impossible to either move les to, or empty, the Trash in Mac OS X. This FAQ, derived from our book Troubleshooting Mac OS X, covers the following Trash-related topics: About the Trash in Mac OS X: a brief overview of the Trash architecture. Techniques for solving Trash problems: common approaches to a variety of Trash problems, including: Trash utilities for eradicating troublesome les. Force the Trash to empty using the Option key. Force the Trash to empty using Terminal. Empty and recreate your account's Trash. Resolving common Trash problems: solutions for the following common Trash problems: Moving locked les to the Trash. Locked les in the Trash. Files in use by other applications. Insufcient privileges needed to Trash an object. Incomplete Internet downloads under Jaguar. Files dragged to the Trash "will be deleted immediately" alert. Immutable les. This FAQ applies to: Mac OS X 10.4 Tiger. Mac OS X 10.3 Panther. Mac OS X 10.2 Jaguar.

About the Trash in Mac OS X


Mac OS X introduced a new architecture for Trash: Each user has their own private, hidden, and invisible Trash folder, located in their Home folder. The UNIX directory path for this folder when logged in to your account is ~/.Trash. Because each user's Trash is private, viewing the contents of the Trash shows only objects which you have placed into the Trash. If you have secondary hard drives or other writable volumes connected to your Mac, each may contain an invisible Trash folder named .Trashes, which in turn contains an invisible Trash folder for each user. When you open Trash to view its contents, it appears that all of the objects you have trashed are in a single Trash folder. In reality, Trash is displaying a list that is the union of the contents of all of the individual Trash folders associated with your account, on all writable volumes.

Techniques for solving Trash problems


Trash utilities for eradicating troublesome les You may want to download and install the freeware utility Trash It! or the shareware utility Cocktail. Using one of these utilities is often the fastest way to Trash recalcitrant les. Note: Be sure to employ a version of the utility that is compatible with the version of Mac OS X you are using. Force the Trash to empty using the Option key

2 of 7

9/24/08 1:35 PM

Solving Trash Problems

http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481

This technique uses a hidden feature of Mac OS X to force the Trash to empty. Perform the following steps in the order specied: 1. Press and hold the mouse button on the Trash icon in the Dock. The context menu for Trash will display. 2. Press and hold the Option key. 3. Select Empty Trash from the context menu for Trash. 4. Release the Option key. Force the Trash to empty using Terminal This technique uses a Terminal command to fore the Trash to empty. Perform the following steps in the order specied: 1. Launch Terminal, located in the Macintosh HD > Applications > Utilities folder. 2. At the Terminal prompt, type the following command exactly as written:
sudo rm -rf ~/.Trash/*

Note that: There is a single space after each of the terms sudo, rm, and -rf in the command. Assure you have typed the command exactly as written before proceeding: typographical errors in this command can have dire consequences, including erasing your hard drive! 3. Press Return. 4. Type your Admin password when prompted, then press Return. The les in the Trash are now deleted. Empty and recreate your account's Trash The following procedure will "kill two birds with one stone." It will both: 1. Empty your Trash. 2. Create a new ~/.Trash directory for you with correct ownership and permissions. Perform the following steps in the order specied: 1. Launch Terminal, located in the Macintosh HD > Applications > Utilities folder. 2. At the Terminal prompt, type the following command exactly as written:
sudo rm -rf ~/.Trash

Note that: There is a single space after each of the terms sudo, rm, and -rf in the command. Assure you have typed the command exactly as written before proceeding: typographical errors in this command can have dire consequences, including erasing your hard drive!

3 of 7

9/24/08 1:35 PM

Solving Trash Problems

http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481

3. Press Return. 4. Type your Admin password when prompted, then press Return. 5. Log out of your account or restart your Mac. 6. Log in to your account. You will now have a new, working, and empty Trash. Steps 1-4 remove all les in your Trash as well as deleting the hidden and invisible ~/.Trash directory for your account. Steps 5 and 6 result in your Trash being recreated with proper ownership.

Resolving common Trash problems


Moving locked les to the Trash Mac OS X 10.2 and later prevent you from moving locked les to the Trash. Locked les display a lock badge in the lower-left corner of their icons. Use the following procedure to unlock a le so that it can be moved to the Trash. 1. Open the Get Info window for the le by either: 1. Selecting the les icon in Finder and pressing the Command-I keyboard combination. 2. Control-clicking the les icon in Finder and selecting Get Info from the les context menu. 2. In the General panel of the le's Get Info window, deselect the Locked checkbox. The check mark will disappear, indicating the le is now unlocked. 3. Close the Get Info window for the le. 4. Trash the le. Locked les in the Trash Try one or more of the following methods to delete locked les in the Trash: Force the Trash to empty using the Option key. Force the Trash to empty using Terminal. Use one of the recommended Trash utilities. Unlock the le using the procedure in Moving locked les to the Trash. Then empty the Trash. Files in use by other applications Use one or more of the following methods if you receive a message indicating that a le can neither be moved to the Trash, nor emptied from the Trash, because it is "in use" by another application. 1. Quit the application that is using the le. This will usually permit you to then move the le to the Trash or to empty the Trash. 2. If you are unsure of the application that has the le "in use," the Terminal command lsof can tell you the name of the process or application that Mac OS X considers to be using the le, as follows: 1. Click the Trash icon in the Dock. A Finder window opens showing the contents of your Trash. 2. Launch Terminal, located in your Macintosh HD > Applications > Utilities folder. 3. Position and resize, if necessary, both the Finder window showing the Trash and the Terminal window so you can simultaneously see both windows fully.

4 of 7

9/24/08 1:35 PM

Solving Trash Problems

http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481

3. 4. 5. 6. 7.

4. At the Terminal prompt type lsof followed by a single space, but do not press Return yet. 5. Drag and drop the le "in use" from the Trash the Finder window opened in step 1 to the Terminal window opened in step 2. The path to the le will appear after the lsof command typed in step 3, i.e. you will see 1. lsof /path_to_file 6. Press Return. 7. If the le is "in use" then the output from lsof will list the names of the applications or processes which claim to be using the le under the rst column heading, COMMAND. 8. If the le is "in use" by an open application, Quit (Command-Q) that application. If a background process has the le "in use," you can use Activity Monitor (Tiger, Panther) or Process Viewer (Jaguar) to Quit that process. 9. Note: One must be careful when quitting processes as certain background processes are needed for Mac OS X. Quitting processes like loginwindow or kernel_task could force you off your account, freeze your Mac, or cause a kernel panic. If you do not know what effect quitting a process may have, do not quit the process. Force the Trash to empty using the Option key. Force the Trash to empty using Terminal. Use one of the recommended Trash utilities. Log out, log in, and then attempt to empty the Trash. Restart your Mac, log in, and then attempt to empty the Trash.

Insufcient privileges needed to trash an object Warning: If Mac OS X informs you that you have insufcient privileges to delete a le, this may be because you are attempting to delete a System-related le. You should not delete System-related les unless you are absolutely sure you know what you are doing. Deleting System-related les could render your system unusable. If you are informed that you have either insufcient privileges or insufcient permissions to trash a le or folder, you may be able to trash the object in question using the following procedure. 1. Make yourself the Owner of the le, with Access of Read & Write, using the instructions in the AppleCare Knowledge Base document from the following list corresponding to the version of Mac OS X you are using: "Mac OS X 10.4 Help: Setting permissions for disks, folders, and les." "Mac OS X 10.3 Help: Setting permissions for disks, folders, and les." "Mac OS X 10.2: How to Change Ownership & Permissions Using the Finder." 2. Trash the le. Incomplete Internet downloads under Jaguar Downloads which fail to complete can sometimes leave you with les which can neither be moved to the Trash nor emptied from the Trash. 1. If the downloaded le is in the Trash, try one or more of the following procedures to empty the Trash: Force the Trash to empty using the Option key. Force the Trash to empty using Terminal. Use one of the recommended Trash utilities. 2. If the downloaded le cannot be moved to the Trash, try the procedure in the AppleCare Knowledge Base document "Mac OS X 10.2: Cannot Delete an Incomplete Copy or Download." In particular, try the TextEdit tip.

5 of 7

9/24/08 1:35 PM

Solving Trash Problems

http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481

Files dragged to the Trash "will be deleted immediately" alert If you are informed that les dragged to the Trash "will be deleted immediately," there are three possible causes: [1] 1. You are either no longer the Owner of your Home folder, do not have Access of Read & Write to such, or both. 2. Your account's Trash, i.e. your ~/.Trash directory, has been deleted. 3. You no longer are the owner of your account's Trash. To resolve this problem, proceed as follows: 1. Assure you are the Owner and have Access of Read & Write on your Home folder: 1. In Finder, press the Command-Shift-H keyboard combination. A Finder window opens showing the contents of your Home folder. 2. Press the Command+I keyboard combination. The Get Info window for your Home folder opens. 3. Select the Get Info window. 4. Select the disclosure triangle for the Ownership & Permissions panel in the Get Info window. 5. If using Mac OS X 10.3 or later, select the disclosure triangle for the Details panel within the Ownership & Permissions panel. 6. If you are not listed as Owner or Access is not Read & Write, then: 1. If the Lock icon next to the Owner pop-up menu appears locked, click it. It should then appear unlocked. 2. Select your account's short name in the Owner pop-up menu. 3. Select Read & Write in the Access pop-up menu immediately below Owner. 4. Type your Admin password if prompted to authenticate. 5. Click the Lock icon again. It should now appear locked. 6. Close the Get Info window. 7. See if you can now place objects in the Trash. If so, the problem is solved: stop here. Otherwise, proceed to the next step. 2. Verify that your ~/.Trash directory exists: 1. Launch Terminal, located in your Macintosh HD > Applications > Utilities folder. 2. At the Terminal prompt, type the following command exactly as written: 1. ls ~/.Trash 3. Press Return. 4. If the response contains "No such file or directory" then: 1. Either log out of your account or restart your Mac. 2. Log in to your account. You should now be able to add objects to the Trash: stop here. 5. Otherwise, proceed to the next step. 3. Empty and recreate your account's Trash. Immutable les There are rare issues which can inhibit emptying the Trash. These include immutable les and les on which the System Immutable ag has been set. If an object cannot be deleted using any of the preceding methods, you may have encountered this rare situation. Dealing with immutable les is covered in the tutorial "How to Fix Stubborn Trash Problems" on OSXFAQ.

Related links
All AppleCare Knowledge Base documents related to Trash and Tiger, Panther, or

6 of 7

9/24/08 1:35 PM

Solving Trash Problems

http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481

Jaguar.

Notes
[1] When dragging les to the Trash from removable media, such as a Zip disk, it is common for Trash to inform you that the les will be deleted immediately. I suspect this was a design choice due to every writable volume having its own Trash folder. If you ejected the Zip disk before emptying the Trash, the les you thought were deleted would still be in the Zip disk's .Trashes folder at the root (top) level of its directory. Hence Mac OS X will immediately delete les moved to the Trash from removable media. This also depends upon the rmware of the device informing Mac OS X that it is a removable media device.

7 of 7

9/24/08 1:35 PM

You might also like