Resolved Help removing locked item in Trash

Discussion in 'OS X El Capitan (10.11)' started by BenTrovato, Dec 13, 2015.

  1. BenTrovato macrumors 68020

    BenTrovato

    Joined:
    Jun 29, 2012
    Location:
    Canada
    #1
    Hey guys, I can't remove this folder from the trash. I was playing around with the external monitor settings a few weeks ago so I made a backup of the DisplayVendorID file. Now that I no longer need it, when I try to empty the trash, all the files except this folder gets deleted. When I try to delete this folder specifically, I get this error. Any help is appreciated.. thanks.
     

    Attached Files:

  2. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #2
    Try running the command below in Terminal to force empty the trash. You will be prompted for your password.

    Code:
    sudo rm -rf ~/.Trash/*
     
  3. BenTrovato thread starter macrumors 68020

    BenTrovato

    Joined:
    Jun 29, 2012
    Location:
    Canada
    #3
    Thanks! I tried it but I get this error: Operation not permitted
     
  4. simon lefisch macrumors 6502a

    simon lefisch

    Joined:
    Sep 29, 2014
    #4
    If anything, reboot the computer and then try to delete. I know it's a pain, however I've had to do that a few times and it's worked.
     
  5. nzreg macrumors member

    Joined:
    Nov 14, 2009
    #5
    This worked for me, change the name of the file I added an x to mine, then restart computer, then empty trash.
    As stated this worked for me on a mini with Yosemite.
    Good luck
     
  6. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #6
    Try the reboot like simon mentioned, then if that does not work try the app TrashIt.
     
  7. BenTrovato thread starter macrumors 68020

    BenTrovato

    Joined:
    Jun 29, 2012
    Location:
    Canada
    #7
    I tried rebooting but still the same effect. I can't rename a file in the trash. When I drag the file out of the trash and onto the desktop, it created a copy so the file in the trash remains.
     
  8. BenTrovato thread starter macrumors 68020

    BenTrovato

    Joined:
    Jun 29, 2012
    Location:
    Canada
    #8
    Just tried TrashIt ... unfortunately it didn't work :(
     
  9. KALLT, Dec 13, 2015
    Last edited: Dec 13, 2015

    KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #9
    Could you run the following command and post the result?
    Code:
    ls -noORa ~/.Trash/*
     
  10. BenTrovato thread starter macrumors 68020

    BenTrovato

    Joined:
    Jun 29, 2012
    Location:
    Canada
    #10
    ls -noORa ~/.Trash/*
    total 0
    drwxr-xr-x 5 0 restricted 170 13 Aug 02:18 .
    drwx------ 4 501 - 136 13 Dec 19:40 ..
    -rw-r--r-- 1 0 restricted,compressed 726 13 Aug 02:18 DisplayProductID-4093
    -rw-r--r-- 1 0 restricted,compressed 704 13 Aug 02:18 DisplayProductID-409c
    -rw-r--r-- 1 0 restricted,compressed 1291 13 Aug 02:18 DisplayProductID-40b6.mtdd
     
  11. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #11
    Alright, that's helpful. Now: have you disabled System Integrity Protection? If not, then that is probably the reason why you cannot delete those files, as they are flagged as "restricted".
     
  12. BenTrovato thread starter macrumors 68020

    BenTrovato

    Joined:
    Jun 29, 2012
    Location:
    Canada
    #12
    I originally disabled it to edit the displayVendor files and then re-enabled it. Should I disable it again and try deleting?
     
  13. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #13
    Yes. The system won't let you modify any files that are flagged as restricted. I am not sure what happened, but I presume that the folder in which these files were contained was not protected, which is why you were able to move the folder along with the files to Trash. In general, the System folder is off-limits now as long as SIP is enabled. You directly manipulated these files while SIP was off, but they were automatically protected once SIP was re-enabled.
     
  14. BenTrovato thread starter macrumors 68020

    BenTrovato

    Joined:
    Jun 29, 2012
    Location:
    Canada
    #14
    Amazing! Thank you so much for your help. It worked. I disabled SIP, then I was able to remove the files from the trash. Thanks again!
     
  15. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #15
    Nice find! That never occurred to me.
     
  16. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #16
    I had a hunch when he mentioned a system folder, knowing that it is possible to end up with restricted files in Trash.
     

Share This Page