MacOS – How to delete a file using the Terminal from the Trash in Mac OS X

macossudotrash

From a previous question I have applied following command to my file.

sudo chflags -R nouchg TopSites.plist
sudo chmod 444 TopSites.plist

Now that the file is locked, I don't know how to remove it.

I currently have the file in my trash.

What does sudo do? And where can I find more info about it?
Where is the Trash stored in Mac OS X?
How do I delete this file?

Best Answer

  • sudo executes a command as another user. By default (as in this case) the user is the superuser root, which can do almost anything. The trash is located in ~/.Trash. You can delete the entire trash by running:

    rm -rf ~/.Trash/*
    
  • Related Question