7 Ways to Delete a File that Mac Says is in Use (Operation Can’t Be Completed)

Does your Mac computer show “The operation can’t be completed because the item is in use” when trying to delete certain files or clear the trash? This usually happens when an app or program in the background is using a file you want to remove or move to the bin. Thankfully, you can force delete these files. Here, let’s see easy ways to force delete the files in use by other programs on your Mac.

Why Do You See “Operation Can’t Be Completed Because The Item Is In Use?”

At times, Mac prevents you from deleting files currently being used by another software on the machine. This is because it feels that removing those files or emptying the trash would corrupt the software in use. This is where you’d face issues like:

Screenshot 2023 01 25 at 5.37.32 PM - Daily Mail India

  • Mac not allowing to delete a file.
  • “The operation can’t be completed because the item is in use” error message.
  • Mac not letting you empty the trash or bin.

How to Delete a File In Use By Other Apps or Processes on Mac?

To delete a file that throws an error saying it’s currently being used, you need to stop the application using it in the background. Several ways to do it include force quitting the app, restarting your Mac, deleting the file using Terminal, and more. Check all of them in detail below.

Method 1- Restart Your Mac

Restart Mac - Daily Mail India

The easiest way to fix “operation can’t be completed” while deleting a file is to restart your Mac computer. Doing so will exit all active and inactive processes running in the background and give your machine a fresh start. If it doesn’t work or you don’t want a restart, proceed with the other methods below.

Method 2- Force Quit All Apps and Delete the File

Mac won’t let you delete the file if a foreground application uses the same. An easy way to fix it would be to quit all the active apps and then delete the file, as shown below.

1. Click the Apple icon on the top left menubar and select Force Quit. Alternatively, you can press Command + Option + Escape.

Force Quit 1 - Daily Mail India

2. Select the app you think might be using the file. Tap Force Quit.

Force Quit 2 - Daily Mail India

3. Tap Force Quit again. Once you’ve quit the app, try deleting the file again.

Force Quit 3 - Daily Mail India

If you’re unsure which program might be using the file, select and quit all of them. Make sure you don’t have any unsaved data.

Method 3- Find and Kill the App Which is Using the File

The next method is to use Terminal to find out which files are currently in use or which your Mac thinks are in use. A simple terminal command “Lsof,” which means the list of all files does the job, post which you can kill the app which is using the file. Follow the steps below:

1. Open Finder > Applications > Utilities and launch Terminal on your Mac.

Terminal 1 - Daily Mail India

2. Type the command in the terminal but don’t press Return yet- Lsof.

3. Add a space and then paste the file path. For example: Lsof /Users/ritik/Desktop/Test.png for an image in the desktop folder.

Terminal 2 - Daily Mail India

How to copy a file path on Mac? Press and hold the Option button and right-click the file. In the context menu, select Copy <filename> as the path name.

4. Once you enter the command, Terminal will give you the list of apps currently using the file. In this case, it’s the Preview app.

Terminal 3 - Daily Mail India

5. You can force quit those applications or kill the programs via Activity Monitor.

6. To do so, open Activity Monitor on your Mac.

7. Search for the program and all its related processes, and tap the X button.

Activity Monitor 2 - Daily Mail India

8. Next, hit Quit or Force Quit to close the program.

Activity Monitor 3 - Daily Mail India

Once done, try deleting the file. You should be able to do it normally without any error messages.

Method 4- Delete the File Using Terminal

Like Windows, Mac lets you delete files via Terminal Window. So if you’re unable to move a file to the bin, follow the steps below to erase the file permanently via Terminal:

1. Launch Terminal on your Mac from either Finder > Applications or the launchpad.

Terminal 1 - Daily Mail India

2. Once the window opens, type rm.

Terminal Delete 1 - Daily Mail India

3. Drag and drop the file you want to delete into the Terminal window. OR paste the file path manually.

Terminal Delete 2 - Daily Mail India

4. Finally, press Return (or Enter) to delete the file permanently.

Terminal Delete 4 - Daily Mail India

Method 5- File Locked or Insufficient Privileges?

If you cannot delete a file on Mac, you may either not have sufficient privileges or the file is probably locked. Check if you can get an Administrator to delete the file. If you already have an admin account, check if the file is locked, as shown below:

1. Open Finder on your Mac.

2. Right-click the file you want to delete and click Get Info.

File Locked 1 - Daily Mail India

3. Head to the General tab.

4. Here, uncheck the box for Locked. On the same page, you can also see the read and write privileges for all users on the machine.

File Locked 2 - Daily Mail India

You shall now be able to delete the file easily. On the same page, you can also see the read and write privileges for all users on the machine.

File Locked 4 - Daily Mail India

Method 6- Disable Login Items and Delete the File

At times, the app using the file may start automatically in the background when you restart your machine. This is why you may see “the operation can’t be completed because the item is in use” when trying to delete the file despite a reboot. In this case, you need to remove the app or program from the list of startup items, as shown below:

1. Click the Apple icon on the top left and select System Settings (or System Preferences).

Login Items 1 - Daily Mail India

2. Select General > Login Items.

Login Items 2 - Daily Mail India

3. Select the app that uses the file or that you think might have something to do with the file. And click the – button.

Login Items 3 - Daily Mail India

4. Furthermore, disable the toggle for “Allow in Background” if the app is in the list.

Method 7- Restart Mac in Safe Mode

If a third-party program or background service is continuously using a file you want to delete and you still can’t figure out what it is, reboot your Mac in Safe mode and delete it. Turn off your Mac by choosing Shut Down in the Apple menu and follow the steps below:

1. Once Mac is completely off, press the Power button until you see “Loading startup options.”

2. Select a volume. Press and hold the Shift key and click Continue in Safe Mode.

3. Your Mac will now restart in safe mode. Open Finder, right-click the file and hit Move to Bin.

Nothing Works? Repair Your Mac in Recovery Mode

Recovery Mac - Daily Mail India

If nothing works, there could be malware or an underlying issue with your disk. You can either contact Apple support or repair your Mac in recovery mode.

For the latter, reboot your Mac in Recovery Mode and wipe the disk using Disk Utility. Then, re-install macOS using the given options. Note that this will erase all your personal data on the drive.

(Resolved) Mac Won’t Delete a File in Use by Other Programs

This is how you can delete a file Mac says is in use by other apps or programs. I hope the above guide helps you erase any file you want to remove on your macOS device. If you still face any errors, feel free to reach out via email or social media. Stay tuned for more such updates.

You might be interested in:

You can also follow us for instant tech news at Google News or for tips and tricks, smartphones & gadgets reviews, join GadgetsToUse Telegram Group or for the latest review videos subscribe GadgetsToUse Youtube Channel.

Source link