my room

iam sure, i didnt bring it home

Archive for November 2010

Solving Trash Problem on mac OSX

leave a comment »

A variety of issues can result in making it difficult or impossible to either move files 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:

This FAQ applies to:

  • Mac OS X 10.5 Leopard®
  • 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 files

You may want to download and install the freeware utility Trash It! or the shareware utilityCocktail. Using one of these utilities is often the fastest way to Trash recalcitrant files.

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

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

  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.

Empty and recreate an account’s Trash

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

  1. Empty the Trash of an affected account.
  2. Create a new ~/.Trash directory, with correct ownership and permissions, for that account.

Perform the following steps in the order specified:

1. If the affected account is protected by FileVault, log in to the affected account, then switch to and log in to your Admin account via Fast User Switching. Otherwise, log in to your Admin account.
2. Open Terminal, located in the Macintosh HD > Applications > Utilities folder.
3.

At the Terminal prompt, type one of the following commands:

If the affected account is: Then type the Terminal command:
Your Admin account: sudo rm -rf ~/.Trash
Another user account: sudo rm -rf /Users/user_name/.Trashwhere user_name is the short name of the affected account.

Note that:

  • There is a single space after each of the terms sudorm, and -rf in the command.
  • Assure you have typed the command exactly as specified before proceeding: typographical errors in this command can have dire consequences, including erasing your hard drive!
4. Press Return.
5. Type your Admin password when prompted, then press Return.
6. If the affected account is your Admin account, log out. If the affected account was another user account that is logged in via Fast User Switching, log out of that account.
7. Log in to the affected account. It will now have a new, working, and empty Trash.

Steps 1-5 remove all files in the affected account’s Trash as well as deleting the hidden and invisible ~/.Trash directory for that account. The remaining steps result in recreating the affected account’s Trash, with proper ownership and permissions.

Resolving common Trash problems

Moving locked files to the Trash

Mac OS X 10.2 – 10.4 prevent you from moving locked files to the Trash; Mac OS X 10.5 permits locked files to be moved to the Trash.

Locked files display a lock badge in the lower-left corner of their icons. Under Leopard, the lock badge only appears if Show icon preview is deselected in the View Options (View > Show View Options) of the Finder window containing the locked file.

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

  1. Open the Get Info window for the file by either:
    1. Selecting the file’s icon in Finder™ and pressing the Command-I keyboard combination.
    2. Control-clicking the file’s icon in Finder and selecting Get Info from the file’s context menu.
  2. 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.
  3. Close the Get Info window for the file.
  4. Trash the file.

Locked files in the Trash

Try one or more of the following methods to delete locked files in the Trash:

Files in use by other applications

Use one or more of the following methods if you receive a message indicating that a file 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 file. This will usually permit you to then move the file to the Trash or to empty the Trash.
  2. If you are unsure of the application that has the file “in use,” the Terminal commandlsof can tell you the name of the process or application that Mac OS X considers to be using the file, as follows:
    1. Click the Trash icon in the Dock. A Finder window opens showing the contents of your Trash.
    2. Open Terminal, located in the 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. At the Terminal prompt type lsof followed by a single space, but do not press Return yet.
    5. Drag and drop the file “in use” from the Trash — the Finder window opened in step 1 — to the Terminal window opened in step 2. The path to the file 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 file is “in use” then the output from lsof will list the names of the applications or processes which claim to be using the file under the first column heading, COMMAND.
    8. If the file is “in use” by an open application, Quit (Command-Q) that application. If a background process has the file “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 orkernel_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.
  3. Force the Trash to empty using the Option key.
  4. Log out, log in, and then attempt to empty the Trash.
  5. Restart your Mac, log in, and then attempt to empty the Trash.
  6. Use one of the recommended Trash utilities.
  7. Empty and recreate the affected account’s Trash.

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 not delete 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 permissions to trash a file or folder, you may be able to trash the object in question using the following procedure.

  1. Make yourself the Owner (Tiger and eariler) of the file or add yourelf under Name (Leopard) for the file, with Access (Tiger and earlier) or Privilege (Leopard) of Read & Write, using the instructions in the Mac Help document from the following list corresponding to the version of Mac OS X you are using:
    1. “Mac OS X 10.5 Help: Setting permissions.”
  2. Trash the file.

Incomplete Internet downloads under Jaguar

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

  1. If the downloaded file is in the Trash, try one or more of the following procedures to empty the Trash:
  2. If the downloaded file 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.

Files dragged to the Trash “will be deleted immediately” alert

When dragging files to the Trash from removable media, such as a Zip® disk, it is common for Trash to inform you that the files will be deleted immediately. This appears to have been a design choice due to every writable volume having its own hidden Trash folder. If you ejected the Zip disk before emptying the Trash, the files 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 files moved to the Trash from removable media. This also depends upon the firmware of the device informing Mac OS X that it is a removable media device. Some removable storage devices identify themselves as hard drives, meaning that items remain in the .Trashes folder if the removable storage device is ejected before the Trash is emptied and will reappear in the Trash when the device is again connected to your Mac.

If you are not dragging files from removable media to the Trash and are informed that files dragged to the Trash “will be deleted immediately,” there are three possible causes:

  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 (Tiger and eariler) and have Access (Tiger and earlier) or Privilege (Leopard) of Read & Write on your Home folder:
    1. In Finder, press the Command-Shift-H keyboard shortcut. A Finder window opens showing the contents of your Home folder.
    2. Press the Command+I keyboard shortcut. The Get Info window for your Home folder opens.
    3. Select the Get Info window.
    4. Open the disclosure triangle for the Ownership & Permissions panel (Tiger and Earlier) or the Sharing & Permissions panel (Leopard) in the Get Info window.
    5. If using Panther or Tiger, open the disclosure triangle for the Details panel within the Ownership & Permissions panel.
    6. If you are not listed as Owner (Tiger and earlier) or under Name (Leopard) or do not have either Access (Tiger and earlier) or Privilege (Leopard) of Read & Write, then correct these issues using the instructions in the Mac Help document from the following list corresponding to the version of Mac OS X you are using:
      1. Warning: When using the instructions in the following Mac Help documents, do not use the Apply to enclosed items option, if available.
      2. “Mac OS X 10.5 Help: Setting permissions.”
      3. Leopard users can also start up from their Mac OS X Leopard Install DVDand use the Reset Home Directory Permissions and ACLs function of the Reset Password function of the Utilities menu.
      4. “Mac OS X 10.4 Help: Setting permissions for disks, folders, and files.”
      5. “Mac OS X 10.3 Help: Setting permissions for disks, folders, and files.”
      6. “Mac OS X 10.2: How to Change Ownership & Permissions Using the Finder.”
    7. Close the Get Info window.
    8. Try to 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. Open Terminal, located in the 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 files

There are rare issues which can inhibit emptying the Trash. These include immutable files and files on which the system immutable bit 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 files is covered in the following resources:

Written by edy aspianto

November 1, 2010 at 1:09 pm

Posted in Uncategorized