Wondershare Recoverit

File Recovery

  • Recovers deleted or lost files effectively, safely and completely.
  • Supports data recovery from 500+ data loss scenarios, including computer crash, partition loss, accidental human error, etc.
  • Supports 1000+ file formats recovery with a high success rate and without any quality loss.
Free Download Free Download Free Download Learn More >
file recovery

How to Force Delete a File on Mac

Wondershare Recoverit Authors

Nov 11, 2024 • Filed to: Solve Mac Problems • Proven solutions

Case: How do I delete a file in Terminal?

Last night, while working on my Mac, I came across a file that was not usable to me anymore. When I was trying to delete it with the regular Mac deletion process, the file was not going to trash. I was trying to force the deleted file using Terminal, but I am not sure about the complete procedure. Can anyone help me with the full steps? Help will be appreciated!

Usually, everyone encounters this problem at some point. Are you also facing the same situation? Don't worry; this post will make you aware of the various reasons that prevent the file from getting deleted and its possible solutions.

We will also introduce you to the best methods for getting back your deleted files.

Part 1. Scenarios to Force Delete a File on Mac

While working on the Mac, sometimes you come across a file that refuses to delete despite several attempts. You even restart your Mac several times; make multiple attempts to get rid of that stubborn file but it is no use. The file still sits in your system.

When you experience this situation, there are some system issues that prevent it from getting deleted. Before you force delete the files on Mac, you must know the various reasons that are stopping the file from getting deleted. Here are scenarios that you might experience:

The situation is more frustrating when you are not using the file, but still, it shows the file is in use or locked.


Part 2. 5 Ways to Force Delete a File on Mac

Deleting a file from a Mac is easy, until and unless you come across the situations mentioned above. We will look here at the various solutions for how to force delete a file on Mac.

Method 1. Secure Empty Trash

Moving a file to trash means you don't want that file anymore. So why not remove it permanently with "Secure Empty Trash?" This is one of the best solutions that work to force delete a file.

Step 1 - Click on Trashcan icon

Click and hold the Trashcan icon in Dock

Step 2 - Change Empty Trash to Secure Empty Trash

Hold the "command" key and click on Trash. Select it when "empty trash" changes to "secure empty trash."

Step 3 - Go To "Finder" Menu

Select "Secure Empty Trash" by clicking on "Finder."

It ensures that the deleted item remains deleted and allows overwriting the space. The option is very useful for obstinate files.

finder menu showing secure empty trash

You can even set your Mac by default to "Secure Empty Trash" through the following path:

Finder -> Preferences -> Empty Trash Securely

finder menu showing preferences

Method 2. Using Terminal

Deleting files using Terminal requires extreme care; a little mistake can complicate things to a greater extent.

Step 1 - Open Terminal

Follow the following path to reach "Terminal"

Applications -> Utilities -> Terminal

Step 2 - Type "sudo rm –R" And Don't Press Enter

Type the above command without quotes and with a space after R. If you are not adding space after R, the command will not work. Remember to not press the "enter" key after typing the command.

Step 3 - Find the File That You Want To Delete

Drag that file to the Terminal window that you want to delete. This will add the filename and the path to it in the Terminal command. Double-check the file, before pressing enter to force delete file.

terminal window showing path to the file that needs deletion

Step 4 - Enter Admin Password and Press Enter

When you are entering the password, nothing will show up. It seems like nothing has changed. Deletion takes its time, depending upon the size of the file.

Method 3. Delete Files Using Safe Mode

Step 1- Click "Restart"

Click on the Apple logo to open the menu and select restart from the drop-down list

window showing restart option

Step 2- Click "Restart" And Hold "Shift" Key

When prompted, click on "restart" to let Mac begin the process. Soon after you begin "restart," click on the "shift" key and hold it.

highlighted shift key

Step 3 - Release "Shift" At Login Window

When the login window appears, you can release shift key now, as the Mac has started in the safe mode.

Step 4 - Move the File to Trash and Empty It

Go to the file location that needs deletion and click on the file menu. From the drop-down list, select "move to trash" to delete the selected file.

Step 5 - Empty Trash and Exit Safe Mode

Click on the trash icon and hold it. When "empty trash" appears, select it to delete the file permanently. Now, restart the system to exit safe mode.

Method 4. Delete Immediately

This feature skips the Trash function and helps to get rid of unwanted files. It immediately deletes files from Mac.

Step 1 - Select the File to Be Deleted

Choose the file that you want to delete from the system permanently. When you are selecting the files hold the "Option" key to access the "File" menu from Finder

Step 2 - Click on "Delete Immediately"

Delete the files immediately by pressing "delete immediately" from the "file" menu. When the pop-up box appears, confirm to delete files.

file menu showing delete immediately

Method 5. Create Temporary User Account

Though this is a time-consuming method, it is best if you don't want to use the above methods.

Step 1 - Create a New User Account

In system preferences, you will view "Accounts preference pane" to create a new user account. It is advisable to remember the password that you have set here.

Step 2 - Move the File to Shared Folder

Select the file that is not getting deleted with the usual procedure. Now, move it to the shared folder that is located in the Users folder.

Step 3 - Log In To the New Account

Log out from your account to log in to the new account for moving the file into the user's trash of this account.

Step 4 – Log In To Normal User Account to Delete File

After moving the file to the trash folder, log out of the new account. Now, log in to regular accounts and delete the temporary account. To remove it, you need to go to "system preferences." Click on "delete immediately," this will remove the new user account along with the file that was not getting deleted earlier.


Part 3. How to Get Back Deleted Files on Mac?

While force deleting the files, have you lost some of your important files? If yes, then don't worry as your deleted files are recoverable with the best software- Recoverit Mac Data Recovery. Here are the steps that will guide through the recovery steps.

Video Tutorial on How to Recover Deleted Files on Mac Even Emptied Trash?

Recent Videos from Recoverit

View More >
Step 1 - Select Location and Click on Start

Download and install Recoverit on your Mac. Launch it and select the hard drive from where your data got lost. After selecting the drive, start the scanning by clicking on the "Start" button.

select drive to recover data

Step 2 - Scan Location

Recoverit runs an all-around scan and gives you a preview of the files, once the scan completes. When the scan is running, you can also make some filters and selections that include searching for lost data through file path or type.

While scanning if you find your missing data, you can even pause or stop the scan in between.

scan running on the drive

Step 3 - Recover files

Recoverit allows you the preview of the recovered files before moving to the recovery step. Take a look at the recovered files and select those that you were looking for. Now click on the "recover" button to let them back into your system.

recover images

Users need to note this point that while recovering the files; never save them on the same path from where you have lost them previously.


Closing Words

While deleting the unwanted files, if the file is not moving out of the system, there is a chance that some internal occurrence is preventing it. If you ever caught yourself up in such situations, don't get frustrated with the problem as now you have learned the best methods to force delete files on Mac. Try the methods discussed above; they will surely resolve your issue.

While force deleting the file, if you lost some of your important files accidentally, you can recover them now. Follow the steps mentioned above and get back access to your essential files.

Recoverit author

Amy Dennis

staff Editor

Home > Resources > Solve Mac Problems > How to Force Delete a File on Mac