Cannot Delete File! Please help!

Discussion in 'macOS High Sierra (10.13)' started by bobbydd21, Feb 27, 2018.

  1. bobbydd21, Feb 27, 2018
    Last edited: Feb 27, 2018

    bobbydd21 macrumors regular

    Joined:
    Nov 26, 2012
    #1
    Hey guys! So I saved an application I made in automator to my desktop. Went to delete it today and it won't delete. I've tried everything. In fact, it won't even move off my desktop. I drag it to the trash, it asked me for my password, makes the trash noise, but stays on the desktop. Same thing happens when I try to move it. I hear the drop noise but it is still on my desktop.

    If I show package contents the only folder inside is an empty folder called contents, which cannot be deleted no matter what I do. I have tried every terminal command (unlocking, rm, etc.), disabled system integrity, tried several third party apps, and repaired permission.

    Please help!
     

    Attached Files:

  2. hughm123 macrumors newbie

    Joined:
    Dec 3, 2014
    #2
    Two possibilities are that either it fails to delete, or that it does get deleted but that Automator (or something) immediately re-creates it.

    What happens if you use "rm" in the terminal - do you get an error message or does the rm command complete without error? If you do get an error message you may want to try "ls -lO filename" (or "ls -lOR") to see if the permissions/ownership is wrong and/or it has immutable flags.

    If the "rm" succeeds but the action comes back, then presumably Automator is re-creating it.

    You might also try quitting Automator while you delete the action, and/or "find ~ -name \*actionname\* -print" to see if there are other parts of the action not on your desktop.
     
  3. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #3
    Maybe check the file modification/creation dates to see if it's being recreated when you delete it.

    Assuming you have an admin account, you could try this in Terminal:

    sudo rm -f /path/to/your/file

    ...you'll be prompted for a password to delete.

    Give that a go and report back!
     
  4. bobbydd21 thread starter macrumors regular

    Joined:
    Nov 26, 2012
    #4
    "rm -rf" returns the following error:
    rm: /Users/bobbydolan/Desktop/Untitled.app/Contents: Operation not permitted

    "ls -lO" returns the following:
    MacBook-Pro:Desktop bobbydolan$ ls -lO /Users/bobbydolan/Desktop/Untitled.app

    total 0

    drwxrwxrwx 2 bobbydolan staff - 64 Feb 27 22:03 Contents



    The date of creation doesn't seem to be changing from the original date either :/
     
  5. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
  6. bobbydd21 thread starter macrumors regular

    Joined:
    Nov 26, 2012
    #6
    Yeah, I typed in "sudo rm -rf /Users/bobbydolan/Desktop/Untitled.app/Contents". It then asks me for my password and then returns operation not permitted.
     
  7. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #7
    Mmmmm... okay. That's a bit of a head-scratcher then.

    I'm clutching at straws now, but maybe try the obvious stuff e.g. restarting your Mac. Also try renaming the app and/or moving it to another folder and see what happens.
     
  8. bobbydd21 thread starter macrumors regular

    Joined:
    Nov 26, 2012
    #8
    I know how you feel. I've been trying to figure this out for weeks now. Tried booting into safe mode, disabling system integrity, and even trying to replace it with a backup of the file. NOTHING works haha. It can't be moved or renamed either.
     
  9. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #9
    Hmmm... Have you checked what the owner and group of the app are?

    ls -l /path/to/your/app
     
  10. bobbydd21 thread starter macrumors regular

    Joined:
    Nov 26, 2012
    #10
    It says the owner is "staff":
    MacBook-Pro:Desktop bobbydolan$ ls -l /Users/bobbydolan/Desktop/Untitled.app

    total 0

    drwxrwxrwx 2 bobbydolan staff 64 Feb 27 22:03 Contents

    Not sure what that means.
     
  11. willmtaylor macrumors G3

    willmtaylor

    Joined:
    Oct 31, 2009
    Location:
    A Natural State
    #11
    While you said the date hasn’t changed, if all of the other solutions aren’t doing the trick, my guess is take a closer look at Automator.
     
  12. MC6800 macrumors 6502

    Joined:
    Jun 29, 2016
    #12
    Untitled.app is a directory (as all .app "files" are), so what you're getting is a list of the contents of that directory, which is another directory inside it named "Contents". To see the permissions of Untitled.app itself, add the 'd' switch to ls:

    ls -ld /Users/bobbydolan/Desktop/Untitled.app

    BTW, your ls above is telling you that "Contents" owner is "bobbydolan" and group is "staff" (both are as expected).

    The problem is most likely not permissions, but that the app is still in use somehow, i.e., some file(s) in that .app directory are still open. This can be checked with:

    lsof | grep Untitled.app

    This will list all open files and then filter that, returning only lines containing "Untitled.app" in the path. The first name on each line is the app owning the file, which you may be able to quit to release it.

    Don't know what's going on with Automator... I created a simple Untitled.app asking for text input, ran it, and tried deleting it, and it told me the file was open, as it should have, but after quitting that app it deleted fine.

    It could be something strange with whatever your Untitled.app is doing. Try creating a brand new app that just does something simple, and test deleting that. If it works, add more until it fails to be deletable.
     
  13. bobbydd21 thread starter macrumors regular

    Joined:
    Nov 26, 2012
    #13
    Okay I did what you suggested and got the following.

    (1)
    ls -ld /Users/bobbydolan/Desktop/Untitled.app

    drwxrwxrwx@ 3 bobbydolan staff 96 Jan 13 17:51 /Users/bobbydolan/Desktop/Untitled.app

    (2) I put in "lsof | grep Untitled.app" and nothing was returned.

    I have tried creating a new simple app, running it, and saving it. Everything works fine and I am able to delete the new app off my desktop with no problem.
     

    Attached Files:

  14. MC6800 macrumors 6502

    Joined:
    Jun 29, 2016
    #14
    Looking over earlier posts, I see your "rm" got an "Operation not permitted", not "Permission denied". That points to SIP and the special flags. Try the "ls -lOd" (capital O, not zero) on the file again to see if it has the schg flag set. If so, first try:

    cd ~/Desktop
    sudo chflags noschg Untitled.app

    That security flag will keep it from being deleted, and may only be clearable when booted in single-user mode (though I was able to delete it as root in El Capitan, not single-user).
     
  15. bobbydd21 thread starter macrumors regular

    Joined:
    Nov 26, 2012
    #15
    Hmm, interesting point. I got the following:

    ls -lOd /Users/bobbydolan/Desktop/Untitled.app

    drwxrwxrwx@ 3 bobbydolan staff sappnd 96 Jan 13 17:51 /Users/bobbydolan/Desktop/Untitled.app

    Does this mean it has the schg flag set? I typed in the other two lines you mentioned and tried to delete it but still nothing.
     
  16. MC6800 macrumors 6502

    Joined:
    Jun 29, 2016
    #16
    Ok, so it has the sappnd (system append-only) flag set. Flags, if any, appear between group and date. I don't know why that would be set, but you can try clearing it using chflags (may require single-user mode):

    cd ~/Desktop
    sudo chflags nosappnd Untitled.app

    Macworld has more about these flags.
     
  17. bobbydd21 thread starter macrumors regular

    Joined:
    Nov 26, 2012
    #17
    YES! It worked! Finally deleted after two weeks haha. Thank you so much! Very strange how it got that flag though.
     

Share This Page

16 February 27, 2018