Files & Cloud / Article
Can't Delete a File? How to Fix Permission and In-Use Errors on Windows and Mac
Photo by Daniel Leżuch on Unsplash

Can't Delete a File? How to Fix Permission and In-Use Errors on Windows and Mac

A file refuses to delete for one of three reasons: a program is still using it, it's locked or protected, or your account doesn't have permission to remove it. On Windows you'll usually see "File in use" or "You need permission to perform this action." On a Mac the message is typically "The operation can't be completed because the item is in use," or a note that the item is locked. Start with the quick checks, then follow the steps for your system.

Quick checks before anything else

  • Close the app that created or opened the file, including any background window, and try again.
  • Restart the computer. This releases most temporary locks, including those held by sync tools such as OneDrive or iCloud.
  • Look at where the file is stored. Files on a network drive, a read-only disk, or a folder that is still syncing can refuse deletion.
  • If the file is on an external drive formatted for Windows (NTFS), a Mac can read it but normally can't delete from it without extra software. If the drive itself is not appearing on your computer, see our guide to fixing an external hard drive that is not showing up.
  • Make sure it isn't a system or app file. If Windows or macOS protects a file, there is usually a reason.

Windows: fix "in use" and permission errors

1. Find and close what is using the file

Press Ctrl+Shift+Esc to open Task Manager, find the app that matches the file, select it, and choose End task. Save your work first, because ending a task discards unsaved changes.

If you can't tell which app is responsible, Microsoft's free PowerToys includes a tool called File Locksmith. Install PowerToys, turn on File Locksmith in its settings, then right-click the file, choose Show more options, and select Unlock with File Locksmith. It lists the processes using the file, and you can end them from there. If the list is empty, select Restart as administrator, because the tool can't see processes run by another user. Only end programs you recognize.

2. Delete the file in Safe Mode

Safe Mode starts Windows with a minimal set of drivers and programs, so many locks never appear.

  1. On Windows 11, open Settings > System > Recovery. On Windows 10, it's Settings > Update & Security > Recovery.
  2. Next to Advanced startup, select Restart now.
  3. Choose Troubleshoot > Advanced options > Startup Settings > Restart.
  4. Press 4 or F4 to start in Safe Mode.
  5. Delete the file, then restart normally.

3. Take ownership or fix permissions

If the message mentions permission, right-click the file, open Properties > Security, and check whether your account has Full control. If not, you may need to take ownership. Do this only for your own files, never for content inside the Windows or Program Files folders.

Open Command Prompt as administrator (search for cmd, right-click it, choose Run as administrator) and run these commands one at a time, replacing the path with your file's path:

  1. takeown /f "C:\path\to\file.ext"
  2. icacls "C:\path\to\file.ext" /grant %username%:F

Then try deleting the file again. If the file sits in a folder owned by another account, you may need an administrator account to finish the job.

4. If the Recycle Bin won't empty

If Windows says the Recycle Bin on a drive is corrupted, open Command Prompt as administrator and run rd /s /q C:\$Recycle.bin, then restart. Windows creates a fresh Recycle Bin folder. Use the drive letter named in the error if it isn't C. This permanently deletes everything currently in the Recycle Bin, so restore anything you still need first.

5. Check the disk for errors

If deleting fails with a read or I/O error, or the file name looks damaged, run chkdsk C: /f from an administrator Command Prompt, using the correct drive letter. Windows may ask to schedule the scan for the next restart.

Mac: fix "in use" and locked errors

1. Quit the app or restart

Press Option+Command+Esc to open Force Quit, select the app that may be holding the file, and quit it. If you aren't sure which app it is, restart the Mac and try again.

2. Unlock the file and check permissions

  1. Control-click the file and choose Get Info.
  2. If Locked is checked, uncheck it.
  3. Open Sharing & Permissions at the bottom, click the lock icon, enter your password, and make sure your user has Read & Write access.

3. Empty the Trash when items are locked

Hold the Option key while choosing Empty Trash from the Finder menu. This long-standing shortcut removes locked items without prompting, but it may behave differently between macOS versions, so move on if nothing happens.

4. Try Safe Mode

  • Apple silicon Mac: shut down, hold the power button until startup options appear, select your startup disk, hold Shift, and click Continue in Safe Mode.
  • Intel Mac: restart and hold Shift until the login window appears.

Delete or empty the Trash, then restart normally.

5. Run First Aid

Open Disk Utility, select your startup volume, and click First Aid. This repairs file system errors that can leave items stuck in the Trash.

6. Terminal, as a last resort

In Terminal, type rm followed by a space, drag the file from Finder into the Terminal window to paste its path, and press Return. The rm command deletes immediately and skips the Trash, so check the path carefully. Don't add sudo or wildcards unless you fully understand what they will remove.

If nothing works

  • Security software. Antivirus can briefly hold a file while it scans. Wait a few minutes and try again instead of turning protection off.
  • Third-party "unlocker" tools. Avoid them unless the developer is one you trust. Many installers bundle extra software. File Locksmith is a safer starting point on Windows.
  • App or system files. If the file belongs to a program, uninstall the program properly rather than forcing the file off the disk. If the uninstaller itself fails, follow our guide on how to remove a program that will not uninstall.
  • Work or school computers. An administrator may have blocked deletion on purpose. Ask your IT team.

What to do next

Most stubborn files are released by closing the app that holds them, restarting, or fixing permissions. Use the heavier tools only after those fail, and back up anything important before running commands that delete files immediately. If a file you can't remove is part of the operating system or an installed app, stop and contact the vendor's support rather than forcing it.