58 lines
4.3 KiB
Markdown
58 lines
4.3 KiB
Markdown
|
|
|||
|
via [Mike Peterson](https://appletoolbox.com/cant-delete-a-file-on-macos-because-its-in-use-fix/)
|
|||
|
![macOS File in Use](https://appletoolbox.com/wp-content/uploads/2019/03/macOS-File-in-Use.jpg)
|
|||
|
|
|||
|
MacBook error message showing the file on mac OS that’s “in use.”
|
|||
|
|
|||
|
Before you do anything else, you should try a couple of things. These are, by far, the easiest fixes for the problem.
|
|||
|
|
|||
|
- Quit the apps that you think may be using the troublesome file. If you don’t know which app might be using it, you may want to quit all apps.
|
|||
|
- If that doesn’t work, you’ll want to simply restart your Mac. After it’s booted back up, try deleting the file.
|
|||
|
- Restarting a Mac should work, but if it doesn’t, there’s likely a startup or login item that is using the file. From here, you’ll want to restart your Mac in [Safe Mode](https://appletoolbox.com/macbook-slow-after-macos-upgrade-tips-consider/) and try deleting it. [Safe Mode](https://support.apple.com/en-us/HT201262) will stop any startup items from running.
|
|||
|
|
|||
|
In addition, here are a couple more in-depth methods for identifying and dealing with stubborn [files from the Trash](https://support.apple.com/en-us/HT201583) (or those that won’t move to the trash).
|
|||
|
|
|||
|
### Using the Terminal to locate the “in-use” app and the corresponding file
|
|||
|
|
|||
|
![macOS File in Use - Terminal](https://appletoolbox.com/wp-content/uploads/2019/03/macOS-File-in-Use-Terminal-540x107.jpg)
|
|||
|
|
|||
|
Use Terminal to locate the app that is using the file.
|
|||
|
|
|||
|
If you’re comfortable using the macOS Terminal, there is a command you can try that will identify which app is using the specific file.
|
|||
|
|
|||
|
- Double-click on the Trash and make sure that a Finder window pops up.
|
|||
|
- Open the macOS Terminal, either by using Spotlight search or by going to Applications —> Terminal.
|
|||
|
- In the next step, you’ll want to type a simple command into the terminal — but don’t hit return just yet!
|
|||
|
- Type this command, followed by a space: **lsof**
|
|||
|
- Then, drag the annoying file from the Trash directly onto the Terminal window.
|
|||
|
- Once some text pops up, hit Return.
|
|||
|
- You should now see a list of the apps that processes that are actively using the file (and keeping it from being deleted).
|
|||
|
|
|||
|
From here, you can simply pinpoint and close the app that’s currently using the file.
|
|||
|
|
|||
|
If the file is being used by a background process, open Activity Monitor. Find the process in the list and click the X icon to terminate it.
|
|||
|
|
|||
|
### Delete Immediately feature on MacBook
|
|||
|
|
|||
|
![macOS File in Use - Delete Immediately](https://appletoolbox.com/wp-content/uploads/2019/03/macOS-File-in-Use-Delete-Immediately.jpg)
|
|||
|
|
|||
|
Use delete immediately feature on macOS to get rid of a file on macOS because it’s ‘In Use’.
|
|||
|
|
|||
|
In OS X El Capitan and [later](https://appletoolbox.com/how-to-show-your-user-library-in-macos-high-sierra-and-sierra/), Apple has also Delete Immediately. It’s a scorched-earth solution and there’s no going back, but it could come in handy for those extremely stubborn files in your Trash.
|
|||
|
|
|||
|
Delete Immediately is only accessible within the Trash app. So open it and select the files you’d like to delete. Control-click those files and select Delete Immediately. Confirm and those files should be gone.
|
|||
|
|
|||
|
### Nothing worked. What now?
|
|||
|
|
|||
|
There may be those rare occasions in which the above steps simply don’t work. If that’s the case for you, there may be an underlying issue on your disk.
|
|||
|
|
|||
|
In these worst-case scenarios, Apple itself recommends booting up your Mac in macOS Recovery mode and using Disk Utility to repair the troublesome drive.
|
|||
|
|
|||
|
If you suspect there’s a deeper problem with your Mac causing file-trash stubbornness, we recommend taking it to your local Genius Bar or an Apple Authorized Service Provider.
|
|||
|
|
|||
|
## Locked files & insufficient privileges
|
|||
|
|
|||
|
In addition to files being used by apps or processes, there are a couple of other things that could prevent you from deleting a file. Here’s a quick overview.
|
|||
|
|
|||
|
- If the file is locked, then you’re going to run into trouble deleting it. You can unlock the file by right-clicking it and selecting Get Info. Open the General tab and deselect the Locked checkbox.
|
|||
|
- Sometimes, you may not have sufficient privileges to delete a file. In most cases, this is a good thing. You can always get an Administrator to delete the file, or give yourself Read & Write permissions in Sharing & Permissions.
|