How to Delete Locked Files on a Mac

Three Methods:Using Secure Empty TrashAltering File PermissionsUsing the Terminal

Locking files is useful for controlling who can access or edit a file. Although they are great for security, deleting a locked file on Mac can be troublesome. Fortunately, there are a few possible workarounds to dealing with files that resist removal, all completely accessible from within the operating system.

Method 1
Using Secure Empty Trash

  1. Image titled Delete Locked Files on a Mac Step 1
    1
    Know the difference between trash and “secure” trash. Secure Empty Trash is a security measure designed by Apple to make sure sensitive files have their indexing removed from the hard drive and the space they occupied overwritten. Due to the way solid state hard drives store data, this method is less reliable on solid state drives, and thus is being phased out by Apple.
    • The Secure Empty Trash option has been removed in OSX 10.11+.
  2. Image titled Delete Locked Files on a Mac Step 2
    2
    Trash the file. Drag the locked file into the trash.
  3. Image titled Delete Locked Files on a Mac Step 3
    3
    Empty the trash securely. Open the trash in the finder and select “File > Secure Empty Trash”. You can also access this with “Ctrl + click > Secure Empty Trash”. The file should delete without error.

Method 2
Altering File Permissions

  1. Image titled Delete Locked Files on a Mac Step 4
    1
    Check the file’s lock status. Select the file, go to “File > Get Info”. A checkbox labeled “Locked” will tell you the file’s current status. If the box is not greyed out, simply uncheck the box and try deleting the file again. If the box is greyed out it means you do not have the proper permissions for the file.
  2. Image titled Delete Locked Files on a Mac Step 5
    2
    Access the inspector. Press and hold Option and go to “File > Show Inspector” (holding the options key will change “Get Info” into “Show Inspector” in the menu). In this menu press the triangle next to “Ownership and Permissions” to expand.
  3. Image titled Delete Locked Files on a Mac Step 6
    3
    Unlock the options. From here you can view the file permissions, but to change them you need to press the lock icon. This will prompt you for your administrator password.
  4. Image titled Delete Locked Files on a Mac Step 7
    4
    Change the permissions for unlocking. Press “You Can” and select the option “Read and Write”. With this change the checkbox next to “Locked” should no longer be inaccessible. Deselect the checkbox and delete the file like normal.

Method 3
Using the Terminal

  1. Image titled Delete Locked Files on a Mac Step 8
    1
    Launch the terminal. “Go to Applications > Utilities > Terminal” to open. The terminal allows you to execute commands to the operating system with code. The “sudo” tag is used to grant root access. After entering a command with it, you may be prompted for your account’s administrator password to proceed with the command.
  2. Image titled Delete Locked Files on a Mac Step 9
    2
    Change the lock status. Enter “sudo chflags nouchg [path to the file]”. This should force toggle the files locked status.
    • For example: “sudo chflags nouchg ~/Applications/Microsoft Word/test.doc”.
    • You can also drag and drop the target file in the terminal window to automatically enter the file path.
  3. Image titled Delete Locked Files on a Mac Step 10
    3
    Force delete the file. If all else fails, another terminal command can force file deletion. Enter “sudo rm -r [path to the file]”. In most cases, this command will delete the file once granted administrator permission with the password.

Article Info

Categories: Mac