Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file in trash, and I cannot delete it. Before you ask me to STFW, no, the file is not locked :-/

The file is a symbolic link to nothing (target is deleted). Here is the output of ls -lO on that file:

lrwxrwxrwx  1 1000  _lpoperator  uappnd,nodump,opaque,compressed 22 Apr  3  2009 fly.pdf -> stuff.pdf

The output of rm is

$ sudo rm fly.pdf
rm: fly.pdf: No such file or directory

However the file does exist, which can be confirmed by ls or by opening trash in Finder. If I empty trash using the menu, it plays that sound and nothing happens. If I try securely empty trash, it complains about not having permission. So I'm stuck... Any suggestion?

BTW, the file in question is in the trash of a volume called "Shared", which is not the boot volume.

UPDATE: @bug pointed out that this may be caused by my link being opaque, and suggested to delete it in a chroot jail. I tried that, and chroot gave me a segmentation fault. Here is what I did for that: I enabled root following this, and followed @bug's answer and this to create the chroot jail. Chroot gave me

# chroot /Volumes/Shared
Segmentation fault: 11

Solution: Ok, it turns out that during this whole time I was just being really silly... *_* :-< I posted my answer here. Thank you all for your ideas and patience!

share|improve this question
Just tried it within linux, created a symlink, removed the target, no complaints when deleting the link afterwards. strange problem :/ –  Baarn Feb 1 '12 at 1:15
Exactly. In my mind sym links are just regular files, so I'm kinda confused... –  Darksair Feb 1 '12 at 1:17
@Darksair I think if you use rm -rf it will probably also work. :) –  tftd Feb 2 '12 at 16:44
@TheDevil: No I tried, and it didn't :-\, which was pretty weird... –  Darksair Feb 2 '12 at 16:45
@Darksair How do you close the question? Post the solution as an answer (instead of editing it into the question). Then, you can accept your own answer by clicking the checkmark next to it. –  Sidnicious Feb 2 '12 at 16:53
show 1 more comment

4 Answers

Try dragging the file to the desktop, open a Terminal window, enter your sudo rm -R then drag the file to the Terminal window.

I've seen this work before and I'd use the -R just in case the file is really a package.

share|improve this answer
Here is what happens when I drag that file to anywhere: if the destination is on the same volume as the file in trash, Finder wants to move it. It asks me for password, and then nothing happens (file not moved); if the destination is on a different volume, Finder wants to copy, and it does that. I can delete the newly copied file, but the file in trash remains. And rm -R produces the same output as without the -R. –  Darksair Feb 1 '12 at 1:47
Try this sudo rm -ri ~/.Trash then logout and login again. –  afragen Feb 1 '12 at 1:53
Thanks for the idea. However it doesn't seem to fix it :-( The file in question is in the trash of a volume called "Shared", so I guess I should replace ~/.Trash with /Volumes/Shared/.Trashes, right? Here is the output: pastie.org/3292919 (sorry for an external link, I cannot have multi-line code here..., and yes, my UID is 1001 :-p) –  Darksair Feb 1 '12 at 2:01
add comment

Have you tried unlink? ...

It might be that the symlink is being bypassed because it's opaque. Try removing it from the context of its containing filesystem by setting up a chroot jail:

cd /Volumes/Shared
mkdir bin
sudo cp /bin/zsh /bin/rm ./bin
chroot /Volumes/Shared
cd .Trashes/1001/abroad
sudo rm fly.pdf
sudo rm -r /bin
share|improve this answer
Thank you for the suggestion. I tried it, and it produces the same output: unlink: fly.pdf: No such file or directory... –  Darksair Feb 1 '12 at 1:51
Wait a minute...that's an opaque link! Is your home folder on a different drive/partition than your boot volume? –  bug Feb 1 '12 at 2:25
The file in question is in the trash of a volume called "Shared", which is not the boot volume, and my home is not on it. What's an opaque link? I tried to remove the opaque flag with chflags, but I couldn't. –  Darksair Feb 1 '12 at 2:27
Symlinks marked as opaque act like ordinary files when the filesystem they're on is mounted within another filesystem. I'll edit with a possible solution... –  bug Feb 1 '12 at 2:36
Chroot complained about not being able to find /bin/zsh, which is my login shell. I also tried sudo chroot -u root /Volumes/Shared rm .Trashes/1001/abroad/fly.pdf, and it complained the same thing about rm. Should I somehow link my /bin and /usr/bin into /Volumes/Shared first? –  Darksair Feb 1 '12 at 2:52
show 3 more comments

Have you tried rm -rf * while in the trash can not sure if it'l work on your link but worth a try its what I use when files in the trash refuse to delete with empty trash

share|improve this answer
Thank you for your answer. I tried it, but it still complains about no such file blabla... –  Darksair Feb 1 '12 at 3:33
add comment
up vote 3 down vote accepted

Chflags has an option -h to not follow links (which I constantly ignored...).

# chflags -h noopaque,nouappnd,dump fly.pdf

And then empty trash.

share|improve this answer
How would a file get in this state on its own? –  Charlie Mar 14 at 14:13
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.