34

How can I add the Trash icon and empty Trash from the sidebar of Finder.app in Mac OS X Lion ?

I dont have a problem to add them in the list of favorites too, but the Trash icon is not draggable.

Sairam
  • 5,736

4 Answers4

38

First, open the trash can by clicking on it in the Dock.
In the Finder, press Command-shift-G (go to folder) and go to ~/.Trash
In the Finder window for .Trash, click the proxy icon in the title bar of the window and drag it to the sidebar.
You then have a trash folder in your sidebar.

To empty the trash from the sidebar, open Automator and create an application. As the sole action in the application, select "Run AppleScript" and use this AppleScript:

on run {}
  tell application "Finder"
    empty the trash
  end tell
end run

Save the application as "Empty Trash", and drag it to the sidebar.

grg
  • 201,078
Daniel
  • 34,803
  • 1
    The answer is great, but is it possible I could customize it to get something like an eject button when external disks are mounted in order to empty the trash ? – Sairam Aug 17 '11 at 16:32
  • 1
    You could Go to Folder "/System/Library/CoreServices/Menu Extras/Eject.menu/Contents/Resources", open the file "Eject.pdf", Go to File, Export, and save it to the desktop as a png file. Open the PNG in Preview, Command-A , Command C. Then select the Empty Trash application, Get Info, highlight the icon in the upper left, and paste the eject image to change the icon to an eject symbol. Then re-drag the eject application to the sidebar. – Daniel Aug 17 '11 at 16:41
  • 1
    Thanks for the awesome tip automator rocks as I have used it for so many missing features. Another tip as well is to drag the application icon to the Finder toolbar. This way it is at the top, and it keeps it's icon. – Nick Jul 26 '12 at 13:48
  • 2
    I couldn't figure out what was meant by "proxy icon" above, but figured I could see the Trash folder if I switched to column view as this allowed me to see the parent folder including the hidden trash folder. I could then drag this to the sidebar and voila. – dunxd Apr 25 '14 at 23:10
  • 3
    @dunxd In the title bar of a Finder window, next to the name of the folder, there is a small image of the folder's icon (this is not limited to the Finder; in many programs, you find a similar icon in the title bar of the window that refers to the file the window represents). This is the proxy icon. Dragging the proxy icon has the same effect of finding the icon for the folder (or file) in the Finder and dragging it somewhere. – Daniel Apr 27 '14 at 05:37
  • 2
    The so called "proxy icon" isn't draggable on High Sierra (10.13). – Nowaker Feb 27 '19 at 10:45
6

According to this article, each partition has its own trash folder, so dragging one to the sidebar is not a global trash. This script is:

on open
  tell the application "Finder"
    move the selection to the trash
  end tell
end open 

Save the script as an application, give it an icon, and drag it into the sidebar.

I think that looks dangerous, though; what if you simply want to see the trash content while having a file selected? This answer looks safe:

on open input
    repeat with i in input
        tell application "Finder" to move i to the trash
    end repeat
end open

on run
    tell application "Finder" to open trash
end run
  • What does the first part of the script do?
    Also, does it matter where this script is saved to/run from?
    – ryanwebjackson Sep 19 '21 at 23:10
  • 1
    That's for when you open it with input like dragging a bunch of files into the icon, and the location of the script shouldn't matter, unlike the former location of trashed files. – Cees Timmerman Sep 20 '21 at 13:09
  • I am not able to drag it to favorites/sidebar, on Big Sur. Not sure if I am just not familiar enough with the sidebar, but this works great otherwise. – ryanwebjackson Sep 20 '21 at 23:03
3

In macOS Ventura, there's a new official way. You can open Trash from Dock, then click File > Add to Sidebar in the Finder's menu bar. (Thanks to this answer for the tip.)

There's no official way to add "Empty Trash" in the sidebar, but once you click the new Trash option in the sidebar, you can just click the Empty button on the top right.

You can also right-click (Control-click) Trash on the Dock and click Empty Trash. Unfortunately this option isn't present if you right-click Trash in the Finder sidebar.

Of course, you can add one of the Automator scripts mentioned in other answers, or see whether the Shortcuts app can help.

ADTC
  • 187
2

If you have iCloud enabled you may need to tweak the path offered by Daniel to

~/Library/Mobile\ Documents/com~apple~CloudDocs/.Trash