Contact Form

Name

Email *

Message *

How to forcibly empty the Trash in OS X

It might sometimes happen that, after trashing a file, you cannot empty the Trash because the file results used/locked by a program or process.
There are two ways to solve this issue:
  1.  Click Stop when the error message pops up (to close it), then open the Trash. Open Terminal and enter the following command: lsof. Press SPACEBAR, after entering the command, then drag the locked file(s) from the Trash to the Terminal and press enter. The output of lsof (list open files) will list the processes or applications that are currently using the trashed file(s), causing the problem. Start Activity Monitor and kill all the listed processes (or kill them from Terminal by using the command kill, followed by the PID of the process/es to be killed). You'll be able to empty the Trash at this point. 
  2. Forcibly empty the Trash: A faster solution, that you can use as an alternative to the previous one or when the other method doesn't solve your problem, is to enter the following command in Terminal: sudo rm -rf ~/.Trash/* (Note: you always need to press ENTER for any command to run). Any files stored in the Trash will be eliminated right away but, as you'll need administrative rights on the machine, you'll have to use sudo and enter your administrative password. The command rm (remove) is here used to delete recursively and with a force option (-rf) all the files stored in a nonempty directory, whereas  ~/ is a shortcut to the Home directory (in OS X, the /Users directory). For more information about this command, enter "man rm" (without quotes) in the Terminal to display a guide to the rm command, or consult the documentation
      
          

Comments

Related Posts Plugin for WordPress, Blogger...