Automatically Empty Your Mac’s Trash 0


Automatically Empty Your Mac’s Trash


Every time you delete a file or folder it will be placed into the trash. Its a last call for file before they are doomed to never see the digital light of day again. The problem with a Trash folder is that they can get quite big in terms of the amount of space used. Although it is useful to have the Trash folder to recover files you have accidentally deleted, it would be useful to automatically delete those files. Today;s post is going to show you how to automatically set up system to delete the files in your Trash. This can be done daily, weekly or on another other time frame.

Setting Up Automatic Deletion

To set up automatic deletion of files within your Trash folder we need to use an Apple Script command. There is currently no built in method, so we are going to build our own. It is simple to set up and run.

Open the Apple Script Editor located in Applications > AppleScript > Script Editor and select Application if prompted. Then copy and paste the following into the window:

tell application “Finder”
empty the trash
end tell

Setting up AppleScript to delete the Trash is only three lines.

Setting up AppleScript to delete the Trash is only three lines.

Hit the compile button to allow AppleScript to build the little script. You can test out the code to ensure it works by pressing the ‘Run’ button. However, this will delete the files in your Trash folder with no warning.

Save out the code as an ‘Application Bundle’ this allows you to run the code as a little application. Save this file somewhere convenient. I recommend you test the application to ensure it works. If you save out the code as an ‘Application’ you may get an error saying PPC code is no longer supported. This is why you have to select ‘Application Bundle’.

Set The Daily, Weekly or Monthly Emptying of Trash

To set up a schedule to empty the trash we are going to use the built in Calendar. You could use something more complicated such as crontab, however I don’t see the advantages. The advantages of using the calendar is that you can easily change and modify when the emptying can commence.

Within Calendar enter an entry like you would for any other event. I recommend a time in which you would normally use your computer, such as early evening. Within the ‘Alert’ section of the new event select ‘Open File’. Find the empty Trash app we have just created. Set the alert to 0 minutes before (you can change this time to anything you wish).

The final step is to set the repeat. Like you would for any other calendar even you can set the repeat to daily, weekly, monthly, yearly or any custom format. For example you can set it to delete every Friday when you leave work, or on the first Monday of each month. It really is up to you.

Set your Mac to empty the Trash every day, week or month.

Set your Mac to empty the Trash every day, week or month.

Every time the event is triggered you Mac will automatically empty the Trash. If you don’t have your Mac on when the alert is raised (the one that pops up in the notification centre) to will issue the command when you next see it, usually when you next switch on your Mac.

If you don’t like the event present in your iCal calendar you can enter it into a new calendar and then hide that calendar using the check boxes on the left hand side of the app.

Empty The Trash When you Log On

If you want to set your Mac up so you can empty the trash when you log on, to start a fresh, you can. Open up System Preference located in your Applications folder. Select the Users & Groups preference option and then select Login Items from the tabs.

Press the small check box under the list. Then find the ‘Empty Trash’ app we created earlier. This will add the app to the list. Now every time you log on, the app will run and your Trash will be emptied. If you want to remove this functionality you can delete it from the list using the minus button in the preference list.

You can empty the Trash every time you log on.

You can empty the Trash every time you log on.


This is not a complicated trick, however it is very useful. I like using an AppleScript (or Automator) app or workflow and then adding it to iCal to occur every week. Its a simple and easy way to automate your Mac.

If you ever want to remove the functionality, simply delete the iCal event.

If you have any questions, please leave a comment using the form below. If you like to learn more about AppleScript I recommend AppleScript: The Comprehensive Guide, alternatively AppleScript: The Definitive Guide, 2nd Edition is very good.

If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips