Delete locked files in OSX trash

OSX BIN TO DELETE FILES

All of us who use the apple operating system, at some point have faced the situation of giving "Empty trash" and that the system responds to us with a notice that there are files that are blocked or in use and that cannot be deleted. On some occasions, in the case of files in use that cannot be eliminated, it is enough to do a system restart and when we click "Empty trash" again and the remove. However, the same is not the case with files that are locked. Specifically, the message that the system shows us in these cases is the following:

"The operation cannot be completed because you do not have permission to access some items."

Fortunately there is a solution. What we need is to get write permissions on the locked file. The easiest way to do this is to use the command line in the "Terminal" tool found in Launchpad / "OTHERS" folder.

When we open the Terminal, we write the following command (just write it, don't execute it, that is, don't press "enter" yet):

chflags -R nouchg (space to leave)

Note that a blank space must be added after «nouchg»On the command line so that it ends in «Nouchg«. Then, without pressing "enter" yet, we open the trash to see the files locked in it. Finally, we select the files that resist being deleted and drag them from the Trash to the Terminal window. If necessary, we will position the Finder window so that part of the Terminal window is still visible. By doing this, we are automatically putting the paths of those files in the command line so we don't have to type them manually.

After introducing the files, we give the "intro" and with this we will have granted write permissions to the unwanted files to be able to erase them from our computer without problem.

Please note that no text message will appear indicating that the operation has been successful.

If the Trash won't empty or if you see a message in Terminal that says:

usage: chflags [-R [-H | -L | -P]] flags file ...

most likely you either did not type the text "chflags -R nouchg" as indicated above or you did not leave the space at the end. All you have to do is repeat the steps from the beginning.

More information - Incinerator: the application to delete files on our Mac

Source - MacTrast


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   river said

    how to delete files locked in trash

  2.   nico said

    Excellent worked perfectly

  3.   Mario Gomez said

    Hey, he keeps giving me the same warning

  4.   Susana said

    it doesn't work, i have done it 5 times, any suggestions ??? Thank you

  5.   Ana said

    By finnnnn !!!! thanks thanks!!!!

  6.   Michael moya said

    Perfect !, also very well explained, thank you very much.

  7.   Caesar said

    The operation cannot be completed because one or more required items are not found.
    (Error: -43)

  8.   Pedroc. said

    Good afternoon, infinite thanks.
    It worked as stated. I had been trying to delete files from the trash for days and it hadn't been possible.
    Thank you.

  9.   oscar perez said

    Hello I am trying to delete a folder that contains the Mac sierra installer but I use Mojave the download because I needed to create an installation usb for another computer and now I take it to the trash and try to delete it and it says "InstallESD.dmg" no It can be modified or deleted because it is a required item for macOS. and I can't find a way to eliminate it, they could help me

    Thank you

    1.    R. Diaz said

      Hello, exactly the same thing happens to me and I don't know what to do, if someone finds a solution it would be greatly appreciated.