14

I am trying to empty my trash, and it keeps giving me the error message:

“Trash” can’t be opened right now because it’s being used by another task, such as moving or copying an item or emptying the Trash. Try again when the current task is complete.

Skip Stop Continue

“Trash” can’t be opened right now because it’s being used by another task, such as moving or copying an item or emptying the Trash. Try again when the current task is complete.

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

7 Answers 7

14

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!

4
  • 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) Commented Jun 5, 2013 at 18:12
  • In 2021 this results in zsh: no matches found: /Users/USER/.Trash/*
    – pkamb
    Commented Nov 13, 2021 at 0:42
  • @pkamb That means there's nothing in the trash on your startup volume (or rather the associated "Data" volume), except maybe invisible files. Is there something in the trash on some other volume? Commented Nov 13, 2021 at 0:52
  • @GordonDavisson No, these are normal files and no attached volume. The thread here thinks it's maybe something about iCloud...?
    – pkamb
    Commented Nov 13, 2021 at 1:08
4

You can use fuser to list the processes that have an open file:

ps -eal | grep $(fuser ~/.Trash)
3

To identify which task is using your Trash, you can use the following command:

lsof | grep Trash

then quit or kill it by specifying PID from the second column, e.g.

kill PID

Add -9 to forcibly kill it.


Alternatively you can install What's Keeping Me application which can identify and kill the processes which are blocking your Trash from being emtied.

As per site brief:

Have you ever have the problem where you can’t empty the Trash or eject a disk because something is preventing you? Usually the reason is because some application has a file open, and thus you can’t get rid of the disk or trash the file. That’s why we made What’s Keeping Me! What’s Keeping Me will identify the application that is holding the item open.

2

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!

1

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.

1

Update: In 13.3.1 this Empty Trash bug has been fixed

There seems to be a new bug in the Finder in Ventura 13.3 where it always complains that the trash can not be opened because you are emptying it. Click "Skip" and it will empty correctly. Hopefully they will fix it soon.

0
  1. Open terminal
  2. Type (no enter): sudo rm -R (add space at the end)
  3. Open Trash window
  4. Drag and drop the files in the terminal
  5. Hit enter

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .