Do you have a file on your Mac that you are unable to delete? It's possible the file may be locked. You can easily unlock a file using the Finder, and some applications allow you to lock and unlock a file from within the app the file is associated with. If all else fails, you should be able to unlock and delete the file with Terminal. This wikiHow teaches you how to delete locked files on a Mac.
Easy Ways to Delete Locked Files on Mac
In most cases, you can drop a locked file into your Trash can, then select Continue to confirm the deletion. Alternatively, right-click or Ctrl -click the file in Finder, select Get Info , and uncheck the box next to Locked . Then, move the file to Trash. If that doesn't work, try changing the file permission settings.
Steps
-
1Try moving the file directly to the Trash. For files that have been locked by you, you can typically just move the file to Trash. Click the file and drag it to the trash can on your Dock. When a warning pops up letting you know the file is locked, click Continue . [1] X Research source
- Selecting Continue will unlock the file and move it to Trash. After that, you can permanently delete it by right-clicking or Ctrl -clicking the trash can and selecting Empty Trash .
- Locking a file prevents it from being modified. It also makes it harder to delete a file accidentally, since you must first confirm that you really want to delete it.
- You can also unlock the file first, then move it to Trash. Read on to learn how.
-
Open the Finder if you want to unlock the file first. Click the Finder icon in the Dock at the bottom of the screen to open the Finder. [2] X Research sourceAdvertisement
-
3Press and hold Control and click the file you want to unlock. This displays a context menu next to the file or folder you want to unlock.
- Alternatively, you can right-click the file, if your mouse or trackpad has a right mouse button.
- If you want to select multiple files, hold Shift and click all the files you want to select.
-
Click Get Info . It's in the context menu that appears when your Control -click (or right-click) a file or folder. [3] X Research source
- If you have multiple files selected, hold Option after right-clicking and click Show Inspector instead.
-
Uncheck the box next to "Locked". It's the last box below the "General" heading. This unlocks the file. [4] X Research source
- If you don't see the checkbox next to "Locked," click the arrow icon ( ⏵ ) next to "General" to expand the General heading.
- If you are not signed in as an Administrator account, you may be asked to enter an administrator password. If asked to do so, enter the password and press Return .
- If you aren’t able to unlock the file this way, you may need to change your permissions or unlock the file in Terminal .
-
Drag the file to the Trash. It's the white icon that resembles a trash can at the bottom of the screen in the Dock. Drag and drop the file into the Trash to delete it. Now that the file is unlocked, you should be able to do so without any problems.
-
Empty the Trash. To empty the Trash, right-click (or Ctrl -click) the Trash icon in the Dock and click Empty Trash . This permanently deletes all files in the Trash. [5] X Research source
- Be sure you really want to delete the file before emptying the Trash. Once the Trash has been emptied, you cannot recover the file(s).
-
Open the Finder. Click theFinder icon in the Dock at the bottom of the screen to open the Finder. If a file is not locked, but you still can't delete it, it's possible that the file permission setting may be preventing you from deleting it.
-
2Hold Control and click the file you want to delete. This displays a context menu next to the file you want to delete.
- Alternatively, you can right-click the file if your mouse or trackpad has a right button.
- If you want to select multiple files, hold Shift and click all the files you want to select.
-
Click Get Info . It's in the context menu that appears when you Control-click (or right-click) a file or folder. [6] X Research source
- If you have multiple files selected, hold Option after opening the context menu and click Show Inspector instead.
-
Scroll down to "Sharing and Permissions". It's at the bottom of the "Get Info" or "Show Inspector" window. This shows permissions for all users on your Mac. [7] X Research source
- If you don't see a list of different user permissions below "Sharing and Permissions," click the arrow icon ( ⏵ ) next to "Sharing and Permissions" at the bottom.
-
Click the lock icon (if locked). It's in the lower-right corner. If you are not signed in under an administrator account, you will need to enter the administrator's username and password to change permissions for a file.
- You’ll also be unable to change permissions if the file or folder is currently locked. Look under the “General” header at the top of the “Get Info” menu and make sure the Locked box is unchecked.
-
Enter the administrator username and password and press ⏎ Return . This unlocks the "Sharing and Permissions" menu and allows you to change the permissions for the file.
- If you’re already signed into an administrator account, you may be able to simply change the permissions without clicking the lock icon or entering a password.
- If you still can’t make changes to your permissions, you may need to unlock the file in Terminal .
-
Click the status next to your username below "Privilege". If you are unable to delete a file, your privilege is most likely set to "Read only." Click Read only below "Privilege" next to your username. [8] X Research source
-
Select Read & Write . This changes the file's permissions status from "Read only" to "Read & Write," which allows you to modify and delete the file. [9] X Research source
-
Drag the file to the Trash. It's the white icon that resembles a trash can at the bottom of the screen in the Dock. Drag and drop the file into the Trash to delete it. Now that you have changed the file permission to "Read & Write," you should be able to delete it without any problems.
-
Empty the Trash. To empty the Trash, right-click (or Control -click) the Trash icon in the Dock and click Empty Trash . This permanently deletes all files in the Trash. [10] X Research source
-
Open the app that the file is associated with. Most Apple applications (including some non-Apple applications that use the Mac convention) allow you to lock a file using the title bar.
- For example, if the file is a Pages document, open Pages. If it is an image file, you would open Preview.
-
Open the file. To open the file, click File in the menu bar and then click Open . Navigate to the file and click it to select it, then click Open .
- Alternatively, you can just double-click the file to open it and the app.
-
Click the filename. It's in the title bar at the top of the screen. This displays a drop-down menu.
-
Uncheck the checkbox next to "Locked". It's in the lower-right corner of the window that appears when you click the file name in the title bar. This unlocks the file. [11] X Research source
-
Drag the file to the Trash. It's the white icon that resembles a trash can at the bottom of the screen in the Dock. Drag and drop the file into the Trash to delete it.
-
Empty the Trash. To empty the Trash, right-click (or Control-click) the Trash icon in the Dock and click Empty Trash . This permanently deletes all files in the Trash.
-
Open the Terminal. If you can’t unlock a file using the Get Info menu, it may be locked with the schg flag, which prevents your Mac’s system from making changes to the file. You can fix this issue in your Mac’s command line interface, the Terminal. The Terminal has an icon that resembles a black screen with a white cursor (). Use the following steps to open the Terminal: [12] X Research source
- Click the magnifying glass icon in the upper-right corner of the desktop to display the Spotlight search bar.
- Type Terminal in the search bar and press Return .
- Click the Terminal icon.
-
2Type sudo chflags -hv noschg . Don’t press Return yet. You’ll need to enter the path to the locked file first.
- If you’re using a Mac with an Intel processor, use the command sudo chflags noschg instead.
-
Enter the path and the file name after the command and press ↵ Enter . For example, if the file is a Word document, the command would look something like sudo chflags -hv noschg ~/Applications/Microsoft Word/test.doc . Press Return to execute the file.
- You can also drag and drop the target file in the Terminal window to automatically enter the file path.
- Alternatively, you can type the command SetFile -a l [path to file] and press Return to unlock a file.
- You may be asked to enter the Administrator's password to continue. If asked to do so, enter the password the Administrator uses to log in to their Mac user profile.
-
Enter sudo rm -R [path to the file] and press ⏎ Return if nothing else works. If all else fails, this Terminal command can force-delete a file. You can either type in the file path or drag and drop the file into the Terminal to add the path.
Expert Q&A
-
QuestionHow do you delete an application that won't delete on a Mac?Gonzalo Martinez is the President of CleverTech, a tech repair business in San Jose, California founded in 2014. CleverTech LLC specializes in repairing Apple products. CleverTech pursues environmental responsibility by recycling aluminum, display assemblies, and the micro components on motherboards to reuse for future repairs. On average, they save 2 lbs - 3 lbs more electronic waste daily than the average computer repair store.If the above methods don't work, try using the application App Cleaner to delete locked files. Just drag the application onto App Cleaner and the application and all of its data will be deleted
-
QuestionNow that secure empty has gone, what reasonable way is there to delete large numbers of locked files, even if they are in the same folder?Community AnswerRight click (or 2 finger click) on the folder, then click "Get Info". Unlock the files through the "Get Info" section.
-
QuestionI don't use an admin password. Terminal command therefore won't give permission. Advice?FancyghostCommunity AnswerYou'll need an admin password to do this. You also need to start commands with "sudo" in order to run them as an admin.
Tips
References
- ↑ https://support.apple.com/zh-sg/guide/mac-help/mchlp1093/mac
- ↑ https://support.apple.com/guide/mac-help/organize-your-files-in-the-finder-mchlp2605/mac
- ↑ https://support.apple.com/guide/mac-help/lock-a-document-on-mac-mchlp1342/mac
- ↑ https://support.apple.com/guide/mac-help/lock-a-document-on-mac-mchlp1342/mac
- ↑ https://support.apple.com/guide/mac-help/delete-files-and-folders-on-mac-mchlp1093/mac
- ↑ https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac
- ↑ https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac
- ↑ https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac
- ↑ https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac