Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am trying to empty my trash, and it keeps giving me an error message that says,

.Trash can't be opened right now because it's being used by another task...

I have tried restarting my computer, running Finder > Secure Empty Trash everything yields the same result and error message from above.

share|improve this question
add comment

4 Answers 4

Try running this command in Terminal:

sudo rm -rf ~/.Trash/*

It should prompt you for your administrator password, but that should remove any files in the trash without any issues.

Good luck!

share|improve this answer
    
I had a similar issue where emptying the trash took... hours.... the sudo command did the trick. (long term solution was a fresh install of OSX) –  Ryan Hollingsworth Jun 5 '13 at 18:12
add comment

You can use fuser to list the processes that have a file open, so

ps -eal | grep `fuser ~/.Trash`

Perry

share|improve this answer
add comment

X LAB

...has a guide for troubleshooting trash problems in Mac OS X.

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.

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. If you are unsure of the application that has the file "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 file, as follows:

  1. Click the Trash icon in the Dock to open a Finder window showing the contents of your Trash.

  2. Open Terminal.

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

  4. Drag and drop the file "in use" from the Trash to the Terminal window. The path to the file will appear after the lsof command:

    lsof /path_to_file
    
  5. Press Return. 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.

  6. If the file is "in use" by an open application, Quit that application. If a background process has the file "in use," use Activity Monitor to terminate that process.

Note: One must be careful when terminating 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.

Empty and recreate an account's Trash

  • Affected account is admin:

    sudo rm -ri ~/.Trash
    
  • Affected account is user:

    sudo rm -ri /Users/user_name/.Trash
    

Then log out and back in.

Note: Assure you have typed the command exactly as specified before proceeding as typographical errors in this command can have dire consequences!

share|improve this answer
add comment

Trash It! (free)

This AppleScript Application force-empties your Trash. Especially useful if you have files or folders in the Trash with permissions set incorrectly, locked Trash items, want to securely delete a stuck item, or trash items from other partitions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.