Keep Your Desktop Clean (with Hazel or Automator)

Like so many other Mac users, I am guilty of saving files to the Desktop. The shortcut (CMND+D) is so much easier than selecting a folder from the sidebar! Which saves me so much time – ALL the time – time I’m able to use to go back and organize the files sitting on the Desktop.

Except, not so much. The reality is that by the time I get around to organizing those files, I’ve mostly forgotten their original purpose. And I hope you weren’t expecting me to keep a list of any graphics files that might link to Desktop files, because there’s no way I’m going back to correct those links until it’s an issue.

Er… I think you can see the issue with saving files to the Desktop. Whether you believe files sitting on the Desktop really do slow your computer down, or you’re also finding that the Desktop is a less than ideal Inbox, automation is here to help!

Hazel

Screen Shot 2016-04-09 at 10.25.51 PM

Hazel is an automation app that sits in your Mac’s System Preferences. The beauty of this app is that it simplifies the sometimes daunting power of Automator, and it does this by allowing you to create a series of rules that it applies to folders you instruct it to monitor.

Keeping your Desktop clean with Hazel is as simple as five steps:

  1. Add the Desktop folder to Hazel.
  2. Add a new rule to the Desktop folder.
  3. Set the first criteria drop down to Any File, since you want all files on the Desktop to be moved.
  4. Under Do the following… set the action drop down menu to Move, then select the folder you want all Desktop files moved to from within the newly prompted drop down menu.
  5. Select Ok.

Conversely, there may actually be specific files that you want to always stay on the Desktop, such as alias folders. Protecting these files is as easy as ensuring that the very top drop down menu in Hazel is set to All, then add a new criteria rule that specifies Kind with the condition is not and the file type Alias (see figure above for reference). This additional step simply tells Hazel to look for any file that is not an alias file, and that file is the one to which the action will apply.

For my purposes, I have created an Inbox folder inside my user folder, and that is where Hazel moves all my Desktop files. Hazel then monitors the Inbox for additional rules, such as moving all image files into a specific folder, or grouping similarly named PDFs into particular folders, etc.

I’ll share what my Inbox folder’s rules look like in the future, but for now feel free to download my Desktop’s Hazel rule for convenience.

 

Automator

The same effect can also be reached by utilizing Automator’s built in Folder Action capabilities, though it requires a few more steps than Hazel.

Follow the steps below to replicate the Hazel rule created above, or scroll down to download the Automator script*:

  1. Open the Automator app (shortcut: CMND+SPACE+Automator+Enter), and select New Document from the menu prompt.
  2. Select Folder Action as your new document type.
  3. Within the new Automator window, specify Desktop from the top drop down menu – this tells your Mac which folder to monitor for file/folder changes. Now add the following actions from the menu options in the left sidebar (use the search bar to quickly navigate action options):
    1. Add Find Finder Items, then specify the Desktop folder from the Search dropdown menu. Here, you can specify the types of files you want Automator to move – or not move. I instructed Automator to find all files except alias files/folders.
    2. Add Move Finder Items, then specify the new folder you wish to house files saved to the Desktop folder from the To dropdown menu.
    3. Save your script (shortcut: CMND+S).**
  4. Technically we should be able to stop here, since our very first step instructed Automator to monitor the Desktop folder; however, Automator does not always perform properly during a script’s first run.
    1. To ensure that our script does work, direct your Finder window to the Desktop folder.
    2. Enable the secondary menu (shortcut: CTRL+select) and hover over the Services option.
    3. Select Folder Actions Setup….
  5. Within the newly prompted Folder Actions Setup window, follow these final steps to ensure your new Automator script runs indefinitely:
    1. Ensure that Enable Folder Actions is checked at the top.
    2. Select the left + button to add the Desktop folder to the left area – telling your Mac to monitor the Desktop folder.
    3. Finally, select the right + button to add your newly created Automator script to the right area – telling your Mac to apply the script to your Desktop folder.

 

  • * If you download the Automator script, move the script to the path below and then complete all steps beginning from Step 4.
  • ** You can find the saved Automator script at: ~/Library/Workflows/Applications/Folder Actions/

Additional Reading

Favorite OS X Apps

As many of my friends know, I am not afraid to try new apps for my Mac and iOS devices – so long as the price is under $20! I spend a lot of time hunting these apps down and then learning how to best use them, so I’m excited to share eight of my current favorite OS X apps in the hopes that they might also help others.

I use these apps every day, and I’m not quite sure how I ever survived without them. If you’re considering downloading (or purchasing) an app, but find yourself on the fence, feel free to reach out to me to ask questions:

1

App - Hazel

Hazel from Noodlesoft (Automated Organization for Your Mac):

Hazel is a friendlier version of Apple’s built in app, Automator, both of which allow you to automate frequent or repetitive actions, like moving any file saved to your Desktop, or organizing your Downloads folder based on a series of rules. What Hazel does well is removing some of the confusion and strain that Automator can be for users, and I’m excited to share some of my favorite Hazel rules with you in future posts!

2

App - Caffeine

Caffeine from Lighthead (Don’t Let Your Mac Fall Asleep):

Perhaps more a utility than an app, I couldn’t resist showcasing Caffeine given my preference for all things coffee-adjacent. Caffeine takes the form of an empty coffee cup in your Mac’s menu bar, just select the cup to fill it up – keeping your Mac awake indefinitely or for a period of time you specify at the initial startup.

3

App - Alfred

Alfred from Running with Crayons, Ltd. (A Keyboard-Driven Productivity App):

Many think of Alfred as a Finder alternative, but I haven’t stopped using Finder since installing Alfred – in fact I use them in very different ways. Using a series of keyboard controls that its user defines, Alfred prompts a variety of actions for specific file formats (though Alfred 2 packed an extra powerful punch with its introduction of workflows). Like Hazel, Alfred is as powerful as its user is creative, so don’t be afraid to grab your favorite cup of coffee and explore the app’s abilities.

4

App - MindNode

MindNode from IdeasOnCanvas (Makes Mind Mapping Easy):

In my profession, I often find myself working with theoretical ideas where visual representation is a critical difference between success and failure. After making do with a few mind mapping web apps, I started searching for something more powerful (and with more visual control) two years ago, and I stumbled across MindNode. I haven’t looked back since, and the app boasts iOS counterparts as a bonus!

5

App - Automator

Automator from Apple (Automate Frequent Tasks):

While I mentioned above that Hazel is a friendly alternative to Automator, this app is still not replaceable in that it allows you to build new apps, bring function to scripts, and add actions to the “Services” section of the secondary click menu.

I currently use Automator to quickly archive selected files, or to combine selected PDFs into one large PDF. I’m excited to share these workflows with you in the future, but in the meantime head over to MacOSXAutomation to learn more!

6App - AppCleaner

AppCleaner from FreeMacSoft (Thoroughly Uninstall Unwanted Apps):

As a fan of keeping my Mac as clean and speedy as possible, I am a big believer in removing all unnecessary files. There are also times when it becomes necessary to start fresh with an app, and the cache files that remain after moving the app to the trash bin just don’t allow for a clean start, which can cause a multitude of unwanted headaches and errors. More dreaded are the times that native apps, such as Safari or Photos, experience corrupt cache files, but finding those cache files is sometimes difficult.

Enter AppCleaner, which searches your Mac’s drive to find all cache files related to the app you wish to remove. Just drag and drop your app into the AppCleaner and then hit the Remove button with an unfettered mind!

7

App - Knock

Knock from Knock Software (Knock to Unlock):

A combination of OS X and iOS, Knock communicates your Mac’s admin password using an iPhone app when two things occur: 1) your Mac prompts a security window; and 2) and you knock on your phone. As someone that relies on a series of extended passwords combining letters, numbers, and symbols, Knock is a pretty nice convenience whenever I open up my Macbook.

Unfortunately, Knock currently only supports one device at a time, so you might need to decide whether that convenience is better at home or in the office, or between your desktop or laptop computers.

8

App - MailButler

MailButler from Feingeist (Your Personal Assistant for Apple Mail):

Though still in the trial period, I have enjoyed MailButler so much that I couldn’t resist including it in my top OS X apps.

Apple users tend to fall in two categories of practice when it comes to native apps, like Mail: 1) never touch them, but always hate them; or 2) use them forever with love. I fall in the latter, as I frequently argue that native apps can do what you want them to do with a little elbow grease – and some time to actually learn the apps. Plus, who wants third-party apps taking up drive space?

Unfortunately, while Apple has made significant improvements to Calendar, Notes, and Reminders, Mail has become less powerful over time (though new markup tools have been a nice addition). Mail still lacks many of the abilities Outlook offers out of the box, like undo Send, request read receipts, or Send scheduling – until MailButler.

OS X Panther or Tiger users may remember that Mail used to allow for third-party extensions and utilities that made these features possible, but these extensions became more extinct with each new OS update. MailButler appears to be the joining of these antiquated extensions – literally – brining them new life and support to your Mac. Unfortunately, the app relies on a monthly subscription fee that feels wrong for an app that operates more like a utility.

I haven’t been forced to commit to a monthly subscription yet, though it will be a tough decision when it comes, as I am seriously enjoying the features MailButler offers both my home and work Inbox.