Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to delete a file because it's of no use to me yet I seem unable to do so. I've gone through these steps so far:

  1. Put file in trash, empty trash. -> Mac keeps on telling me: 12 items to remove..
  2. rm -rf /.Trash/* -> process seems to go on indefinitely
  3. sudo rm -R path/to/file -> same as above

I'm desperate.. what should I do?

share|improve this question
    
Is the file really still at path/to/file in step 3? This would mean that moving to Trash didn't work at all. –  patrix Sep 26 '11 at 17:47
    
@patrix: yes I moved it back so I could clean the rest of the trash. removing it seems to have worked now. What i did is this: secure empty trash -> still hangs but the file (actually a folder) is now empty. restart. retry 3. Don't know why this worked. –  romeovs Sep 26 '11 at 18:05
    
sudo should override everything and delete it, provided you have the syntax right (as outlined by patrix below). Another option might be to send it to the Finder's trash and instead of emptying it normally, go to the Finder menu item and select "secure empty trash." That also overrides even "locked" files that are in use to empty the contents. –  cksum Sep 26 '11 at 21:31

4 Answers 4

up vote 1 down vote accepted

If the file is on a partition other than the startup volume, it will not be in ~/.Trash/, rather it will be in /Volumes/volumeName/.Trashes/userID/, where volumeName is the name of the partition and userID is your user's numerical user ID (probably 501 if you only have one user).

To be certain you have the correct path to the file, I would recommend using Terminal's drag and drop feature. This also helps to avoid accidentally deleting files with the potentially dangerous sudo rm -Rf command.

Without pressing return at the end, type sudo rm -Rf with a trailing space at the end,

sudo rm -Rf <--leave a space after -Rf, do not press return yet

then drag the file you want to delete from the Finder into the Terminal window. Then press return.

If it still won't delete, you should probably verify the disk with Disk Utility.

share|improve this answer

If you've put the file in your own Trash, you got the path wrong in step 2:

rm -rf ~/.Trash/*

or (because there might be something wrong with the file permissions)

sudo rm -rf ~/.Trash/*
share|improve this answer

Well, this isn't as convenient as deleting the files without logging out, but this is virtually guaranteed to work (it's never failed for me): Use Finder to move it to the Trash. Then reboot, then empty the Trash.

share|improve this answer

Did you try this :

sudo rm -Rf ~/.Trash/*

Then, type your admin password to confirm

share|improve this answer

Your Answer

 
discard

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.