27 February 2019

Can’t Empty the Trash on Your Mac? Here’s How to Fix It


macos-trash

Normally, emptying the Trash folder on your Mac is a quick and easy process. You open the folder and click the Empty button in the top-right corner. That’s all it takes before you get on with your life.

However, there are cases when Trash doesn’t let you permanently delete certain files. This can happen for a variety of reasons.

This guide covers how to deal with such cases. It shows how to check whether files are in use or locked. We’ll also review how to perform disk repairs in cases where a disk problem is stopping you from emptying Trash. And for advanced use, we’ll look at how to use Terminal to force the Trash to empty.

How to Empty the Trash on Mac When Files Are in Use

Trash window telling user that file is in use

Often, your Mac’s Trash won’t empty because certain files inside are still in use.

Another app, or some kind of background operational process, might be using them. Either way, you’ll know this is the case because a popup will tell you something like The operation can’t be completed because the item is in use.

This means you’ll have to close the file before you can delete it permanently. For example, if the item is a Word document, you’ll have to close it in Word. If it’s an application, you’ll have to quit out of that app. And so on.

Sometimes you might not be able to identify exactly where the file is open. In these cases, perhaps a background process is using it. To test whether this is so, restart your Mac and try deleting the file again. If a background process was using it, you’ll be able to delete from the Trash this time.

Advanced File Usage Troubleshooting

Alternatively, a startup or login item might be using the file in question. You can get around this by starting up your Mac in Safe Mode. This stops some software from booting up automatically.

To boot your Mac in Safe Mode and empty the Trash:

  1. Shut down your Mac.
  2. Turn on your Mac and immediately hold Shift.
  3. Once you’ve booted up in Safe Mode, open the Trash.
  4. Click the Empty button (in the top-right corner).

This will delete the file if a startup app was using it. If not, one other option is to use Terminal to check which app has the file locked. Here’s how you do that:

  1. Open Trash.
  2. Press Cmd + Space to launch Spotlight.
  3. Type Terminal and press Return.
  4. Type lsof and press Space. This command means list open files and displays a list of files in use with the processes that opened them.
  5. Go back to Trash and drag the file you want to delete to the Terminal.
  6. Press Return to run the command.

This will bring up a list of the apps using the file.

Terminal screen showing apps using file in Trash

Close all of them, although bear in mind that Terminal might not give the full names of apps. For example, in the screenshot above, it lists Microsoft Word as Microsoft 1839. You may thus have to try closing a number of different apps.

If this was your first taste of the Terminal, check out our Terminal beginner’s guide for more tips.

How to Empty the Trash When Files Are Locked

Trash unable to delete a locked file

In another case, the files you’re trying to delete may be locked. You can easily correct this by going to Trash and unlocking them. Here’s what you need to do:

  1. Open the Trash.
  2. Right-click the file you want to delete.
  3. Click Get Info.
  4. Click the Locked checkbox.

This will unlock the file and let you delete it. Once again, you can do this by clicking the Empty button. Alternatively, you can right-click the file and click Delete Immediately.

How to Empty Trash When Your Disk Needs Repairing

macOS Disk Utility

It’s possible for a hard disk issue to prevent your Trash from emptying. You can run a test for this by launching Disk Utility and using the First Aid function.

Follow these instructions to complete the process:

  1. Press Cmd + Space to launch Spotlight.
  2. Type Disk Utility and press Return.
  3. Select your hard disk’s name. Make sure it’s the one containing the file you want to delete.
  4. Click First Aid, then choose Run.

The First Aid function will let you know if it finds any errors, but it can’t fix problems on your main drive while it’s running. You’ll need to reboot your Mac in Recovery Mode to fix disk issues on your startup drive.

Repairing your Mac’s disk is a good option when you have a problem and other steps haven’t worked. In most cases, a disk repair should let you permanently delete items in the Trash.

However, if it isn’t a disk issue at the root of your problems, you may need to force the Trash to empty.

How to Force the Trash to Empty

Using Terminal to force Trash to delete files

 

There are several ways to force-empty the Trash. If a file is locked and you can’t unlock it, you can try deleting it while holding the Option key. Trying holding Option while you click the Empty button.

By holding Option, your Mac will bypass any locks on files. This is quite useful if your Mac won’t let you unlock any file.

One final option is to use a Terminal command to force the Trash to empty. This overrides any locks on your files and deletes files that are still in use. It also gets around any other errors that prevent the Trash from emptying.

As such, it’s an effective way of permanently deleting files. However, it might be that macOS is preventing you from deleting files for a good reason. You may have accidentally sent something to the Trash that’s important for a certain app to operate.

You should therefore proceed with caution when using the nuclear method described below:

  1. Press Cmd + Space to open Spotlight.
  2. Type Terminal and press Return to launch it.
  3. Type sudo rm -R and press the Space. This is the command to force-delete files.
  4. Go back to the Trash and drag the files you want to delete to the Terminal window.
  5. Press Return.
  6. Enter your Mac’s administrator password to authorize the command. This won’t show as you type it, which is a security feature.
  7. Press Return to confirm and run the command.

This will immediately delete the files you dragged to the Terminal window. You can finally rest assured that your Mac is a bit cleaner.

Back to a Neat and Tidy Mac

Emptying your Trash is a good way of keeping your Mac clean and uncluttered. It saves disk space, helping your Mac to run more smoothly.

And there are other ways to spring clean your Mac. We’ve looked at how to clean your Mac desktop and how to make your old Mac feel like new if you have an older machine. So if you want to give your computer a boost, give those a look.

Read the full article: Can’t Empty the Trash on Your Mac? Here’s How to Fix It


Read Full Article

No comments:

Post a Comment