solving trash problems mac

7
About X-Books X-FAQs X-Services X-Links Support Solving Trash Problems http://www.thexlab.com/faqs/trash.html#Anchor-Force-11481 1 of 7 9/24/08 1:35 PM

Upload: almra

Post on 12-Mar-2015

72 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Solving Trash Problems MAC

About X-Books X-FAQs X-Services X-Links Support

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

1 of 7 9/24/08 1:35 PM

Page 2: Solving Trash Problems MAC

Solving Trash ProblemsA variety of issues can result in making it difficult or impossible to either move files to, orempty, the Trash in Mac® OS X. This FAQ, derived from our book Troubleshooting MacOS 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 Trashproblems, including:

Trash utilities for eradicating troublesome files.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 Trashproblems:

Moving locked files to the Trash.Locked files in the Trash.Files in use by other applications.Insufficient privileges needed to Trash an object.Incomplete Internet downloads under Jaguar.Files dragged to the Trash "will be deleted immediately" alert.Immutable files.

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 theirHome folder. The UNIX® directory path for this folder when logged in to youraccount is ~/.Trash.Because each user's Trash is private, viewing the contents of the Trash shows onlyobjects which you have placed into the Trash.If you have secondary hard drives or other writable volumes connected to yourMac, each may contain an invisible Trash folder named .Trashes, which in turncontains an invisible Trash folder for each user.When you open Trash to view its contents, it appears that all of the objects youhave trashed are in a single Trash folder. In reality, Trash is displaying a list that isthe union of the contents of all of the individual Trash folders associated with youraccount, on all writable volumes.

Techniques for solving Trash problems

Trash utilities for eradicating troublesome files

You may want to download and install the freeware utility Trash It! or the sharewareutility Cocktail. Using one of these utilities is often the fastest way to Trash recalcitrantfiles.

Note: Be sure to employ a version of the utility that is compatible with the version ofMac OS X you are using.

Force the Trash to empty using the Option key

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

2 of 7 9/24/08 1:35 PM

Page 3: Solving Trash Problems MAC

This technique uses a hidden feature of Mac OS X to force the Trash to empty. Performthe following steps in the order specified:

Press and hold the mouse button on the Trash icon in the Dock. The context menufor Trash will display.

1.

Press and hold the Option key.2.Select Empty Trash from the context menu for Trash.3.Release the Option key.4.

Force the Trash to empty using Terminal

This technique uses a Terminal command to fore the Trash to empty. Perform thefollowing steps in the order specified:

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 thecommand.Assure you have typed the command exactly as written beforeproceeding: typographical errors in this command can have direconsequences, including erasing your hard drive!

3. Press Return.

4. Type your Admin password when prompted, then press Return. The files in theTrash are now deleted.

Empty and recreate your account's Trash

The following procedure will "kill two birds with one stone." It will both:

Empty your Trash.1.Create a new ~/.Trash directory for you with correct ownership and permissions.2.

Perform the following steps in the order specified:

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 thecommand.Assure you have typed the command exactly as written beforeproceeding: typographical errors in this command can have direconsequences, including erasing your hard drive!

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

3 of 7 9/24/08 1:35 PM

Page 4: Solving Trash Problems MAC

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 files 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 recreatedwith proper ownership.

Resolving common Trash problems

Moving locked files to the Trash

Mac OS X 10.2 and later prevent you from moving locked files to the Trash. Locked filesdisplay a lock badge in the lower-left corner of their icons.

Use the following procedure to unlock a file so that it can be moved to the Trash.

Open the Get Info window for the file by either:Selecting the file’s icon in Finder™ and pressing the Command-I keyboardcombination.

1.

Control-clicking the file’s icon in Finder and selecting Get Info from thefile’s context menu.

2.

1.

In the General panel of the file's Get Info window, deselect the Locked checkbox.The check mark will disappear, indicating the file is now unlocked.

2.

Close the Get Info window for the file.3.Trash the file.4.

Locked files in the Trash

Try one or more of the following methods to delete locked files 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 file using the procedure in “Moving locked files to the Trash.” Thenempty the Trash.

Files in use by other applications

Use one or more of the following methods if you receive a message indicating that a filecan neither be moved to the Trash, nor emptied from the Trash, because it is "in use" byanother application.

Quit the application that is using the file. This will usually permit you to then movethe file to the Trash or to empty the Trash.

1.

If you are unsure of the application that has the file "in use," the Terminalcommand lsof can tell you the name of the process or application that Mac OS Xconsiders to be using the file, as follows:

Click the Trash icon in the Dock. A Finder window opens showing thecontents of your Trash.

1.

Launch Terminal, located in your Macintosh HD > Applications > Utilitiesfolder.

2.

Position and resize, if necessary, both the Finder window showing the Trashand the Terminal window so you can simultaneously see both windows fully.

3.

2.

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

4 of 7 9/24/08 1:35 PM

Page 5: Solving Trash Problems MAC

At the Terminal prompt type lsof followed by a single space, but do notpress Return yet.

4.

Drag and drop the file "in use" from the Trash — the Finder window openedin step 1 — to the Terminal window opened in step 2. The path to the filewill appear after the lsof command typed in step 3, i.e. you will see

lsof /path_to_file1.

5.

Press Return.6.If the file is "in use" then the output from lsof will list the names of theapplications or processes which claim to be using the file under the firstcolumn heading, COMMAND.

7.

If the file is "in use" by an open application, Quit (Command-Q) thatapplication. If a background process has the file "in use," you can useActivity Monitor (Tiger, Panther) or Process Viewer (Jaguar) to Quit thatprocess.

8.

Note: One must be careful when quitting processes as certain backgroundprocesses are needed for Mac OS X. Quitting processes like loginwindow orkernel_task could force you off your account, freeze your Mac, or cause akernel panic. If you do not know what effect quitting a process may have, donot quit the process.

9.

Force the Trash to empty using the Option key.3.Force the Trash to empty using Terminal.4.Use one of the recommended Trash utilities.5.Log out, log in, and then attempt to empty the Trash.6.Restart your Mac, log in, and then attempt to empty the Trash.7.

Insufficient privileges needed to trash an object

Warning: If Mac OS X informs you that you have insufficient privileges to delete a file,this may be because you are attempting to delete a System-related file. You should notdelete System-related files unless you are absolutely sure you know what you are doing.Deleting System-related files could render your system unusable.

If you are informed that you have either insufficient privileges or insufficient permissionsto trash a file or folder, you may be able to trash the object in question using the followingprocedure.

Make yourself the Owner of the file, with Access of Read & Write, using theinstructions in the AppleCare® Knowledge Base document from the following listcorresponding to the version of Mac OS X you are using:

"Mac OS X 10.4 Help: Setting permissions for disks, folders, and files.""Mac OS X 10.3 Help: Setting permissions for disks, folders, and files.""Mac OS X 10.2: How to Change Ownership & Permissions Using theFinder."

1.

Trash the file.2.

Incomplete Internet downloads under Jaguar

Downloads which fail to complete can sometimes leave you with files which can neitherbe moved to the Trash nor emptied from the Trash.

If the downloaded file is in the Trash, try one or more of the following proceduresto 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.

1.

If the downloaded file cannot be moved to the Trash, try the procedure in theAppleCare Knowledge Base document "Mac OS X 10.2: Cannot Delete anIncomplete Copy or Download." In particular, try the TextEdit tip.

2.

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

5 of 7 9/24/08 1:35 PM

Page 6: Solving Trash Problems MAC

Files dragged to the Trash "will be deleted immediately" alert

If you are informed that files dragged to the Trash "will be deleted immediately," there arethree possible causes: [1]

You are either no longer the Owner of your Home folder, do not have Access ofRead & Write to such, or both.

1.

Your account's Trash, i.e. your ~/.Trash directory, has been deleted.2.You no longer are the owner of your account's Trash.3.

To resolve this problem, proceed as follows:

Assure you are the Owner and have Access of Read & Write on your Home folder:In Finder, press the Command-Shift-H keyboard combination. A Finderwindow opens showing the contents of your Home folder.

1.

Press the Command+I keyboard combination. The Get Info window for yourHome folder opens.

2.

Select the Get Info window.3.Select the disclosure triangle for the Ownership & Permissions panel in theGet Info window.

4.

If using Mac OS X 10.3 or later, select the disclosure triangle for the Detailspanel within the Ownership & Permissions panel.

5.

If you are not listed as Owner or Access is not Read & Write, then:If the Lock icon next to the Owner pop-up menu appears locked, clickit. It should then appear unlocked.

1.

Select your account's short name in the Owner pop-up menu.2.Select Read & Write in the Access pop-up menu immediately belowOwner.

3.

Type your Admin password if prompted to authenticate.4.Click the Lock icon again. It should now appear locked.5.Close the Get Info window.6.

6.

See if you can now place objects in the Trash. If so, the problem is solved:stop here. Otherwise, proceed to the next step.

7.

1.

Verify that your ~/.Trash directory exists:Launch Terminal, located in your Macintosh HD > Applications > Utilitiesfolder.

1.

At the Terminal prompt, type the following command exactly as written:ls ~/.Trash1.

2.

Press Return.3.If the response contains "No such file or directory" then:

Either log out of your account or restart your Mac.1.Log in to your account. You should now be able to add objects to theTrash: stop here.

2.

4.

Otherwise, proceed to the next step.5.

2.

Empty and recreate your account's Trash.3.

Immutable files

There are rare issues which can inhibit emptying the Trash. These include immutable filesand files on which the System Immutable flag has been set. If an object cannot be deletedusing any of the preceding methods, you may have encountered this rare situation.Dealing with immutable files is covered in the tutorial "How to Fix Stubborn TrashProblems" on OSXFAQ.

Related links

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

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

6 of 7 9/24/08 1:35 PM

Page 7: Solving Trash Problems MAC

Jaguar.

Notes

[1] When dragging files to the Trash from removable media, such as a Zip® disk, it iscommon for Trash to inform you that the files will be deleted immediately. I suspect thiswas a design choice due to every writable volume having its own Trash folder. If youejected the Zip disk before emptying the Trash, the files you thought were deleted wouldstill be in the Zip disk's .Trashes folder at the root (top) level of its directory. Hence MacOS X will immediately delete files moved to the Trash from removable media. This alsodepends upon the firmware of the device informing Mac OS X that it is a removablemedia device.

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

7 of 7 9/24/08 1:35 PM