1. Computer Skills

9 Hazel Rules to Increase Your Productivity

Scroll to top

Hazel, a folder monitoring application, has long been a favorite among many a Mac enthusiast. Hazel will automatically take action on your files, using the rules you create, keeping your folders in order. If you’ve wished that all of your downloaded music or any other sort of files would just do what you wanted them to, using only the power of your mind, well, this is the next best thing. We’ll look step-by-step at how to create a rule from scratch and then set up nine rules you can customize for your needs.


What You’ll Need

Before you get started you’ll need to install Hazel, a third-party System Preference pane, via the Noodlesoft website. The full version will cost $25 and there’s a 14-day free trial.


Create a Rule

Hazel depends on rules that you create or download and import. You specify the folders you want Hazel to watch and then set exact conditions that must be met before Hazel will act. Once those conditions are met, Hazel gets to work, performing the actions you’ve assigned. You’ll need to be specific, though, or you’ll find Hazel doing all sorts of things you didn’t intend or nothing at all. That’s no problem to troubleshoot, and we’ll even look at how to fix a broken rule.

First we'll try creating a generic rule to learn how Hazel works, and later in the tutorial we'll apply these skills to creating specific Hazel rules to improve your workflow.


Step 1: Add a Folder to Hazel

If the folder you want Hazel to watch isn’t already in Hazel’s list, click the plus sign at the bottom of the Folders list and browse until you find the right one.

Add the folder to be monitored to Hazel.Add the folder to be monitored to Hazel.Add the folder to be monitored to Hazel.
Add the folder to be monitored to Hazel.

Step 2: Pause the Folder

Before you get started, it’s not a bad idea to pause the rules active on the folder you’re working with, just in case you save a half-finished rule and cause Hazel to do some wacky, albeit inadvertent, actions to the files in that folder.

Pause a folder’s rules by clicking the gear below the Folders list and selecting Pause Rules. A pause icon will appear next to the rule. When you’re ready to start it back up again, click the gear again and select Resume Rules.

Pause your folder to be on the safe side.Pause your folder to be on the safe side.Pause your folder to be on the safe side.
Pause your folder to be on the safe side.

Step 3: Open a New Rule

With your folder selected, click the plus sign under Rules to get open a new rule. Type out a descriptive name for your rule, so you’ll have an idea of what it does if you take a look at it sometime down the line.

Open a new rule and give it a name.Open a new rule and give it a name.Open a new rule and give it a name.
Open a new rule and give it a name.

Step 4: Set Your Conditions

Determine the conditions for your rule. That is, what triggers must be met for Hazel to act? It might be that a new file drops into the folder, or Hazel detects an older file in the folder. Hazel will look for files with specific names, access dates, comments, sizes, filetypes, origins, and much more, and Hazel will accept as many conditions as you’ll throw at it. You can specify that a file must meet some, all, or none of these criteria.

Select whether your file must meet some, all, or none of the conditions of your rule.Select whether your file must meet some, all, or none of the conditions of your rule.Select whether your file must meet some, all, or none of the conditions of your rule.
Select whether your file must meet some, all, or none of the conditions of your rule.

You’ll want to create conditions that only include the intended files and don’t scoop up anything extraneous. The key is to set conditions that are broad enough that Hazel finds all of the files you want but narrow enough that everything else is excluded.

Create exact conditions that will only apply to the intended files.Create exact conditions that will only apply to the intended files.Create exact conditions that will only apply to the intended files.
Create exact conditions that will only apply to the intended files.

Step 5: Set Your File Actions

Hazel needs to know what to do with all the files it’s found as a result of the conditions you set. Again, Hazel can do a whole laundry list of actions, so you don’t just have to pick one. Your files can be moved to a new folder, renamed with a specific pattern, moved into a new subfolder, archived, and lots of other actions.

Set your file actions.Set your file actions.Set your file actions.
Set your file actions.

If you know what you’re doing, and you will by the end of this tutorial, you can get Hazel to run an AppleScript or shell script and perform all kinds of functions, beyond the basic actions that come standard with Hazel.

A finished rule with multiple conditions and actionsA finished rule with multiple conditions and actionsA finished rule with multiple conditions and actions
A finished rule with multiple conditions and actions

Step 6: Save the New Rule

Make sure to click OK to save your new rule. If you get distracted and accidentally exit out of Hazel without saving your rule, everything is lost.

Back in the Hazel Folders tab, verify that your new rule is under the intended folder and has a checkmark next to it, indicating that it’s enabled. If everything looks good, you can go ahead and resume if you paused the rules and actions before.

Verify that your rule is in place and active.Verify that your rule is in place and active.Verify that your rule is in place and active.
Verify that your rule is in place and active.

If nothing seems to happen immediately and you think it should, click the gear beneath the Folders list and select Run Rules Now. If your rule is set up correctly, Hazel should start acting on your files now.


Step 7: Check For Signs of Trouble

If after selecting Run Rules Now, you still don’t see anything happening, select the folder giving you trouble in the Folders list and click the eye icon below. Hazel will pop open a window of all the files and folders within the folder being monitored.

To the right you’ll see any rules that match those files. If that section is blank, though, your files don’t meet the criteria of your rule. You should have another look inside your rule and edit it until you can make a good match.

Any rules that match your files will be in the right column.Any rules that match your files will be in the right column.Any rules that match your files will be in the right column.
Any rules that match your files will be in the right column.

Creating Your Own Rules

So now you know how to make rules, and that’s great, right? That and two bucks will get you a Coke. Just knowing how to make rules in Hazel isn’t doing you a lot of good, is it, unless you know how to successfully use Hazel rules to create a better experience on your Mac.

We’ll go through nine rules to really make your Mac fly, and once you’ve got your Hazel rules setup, it’s pretty much hands off for you.


Nine Rules to Customize

My Downloads folder gets out of control and I end up with a lot of cruft on my Desktop. If I’m not careful I’ll just throw everything into Documents and wind up with an even bigger mess there. Don’t try to tell me I’m the only one, because, first it will hurt my feelings and second I know that’s just a big lie. Whether you do your downloading to your Desktop, Downloads, Documents, or somewhere else entirely, I’ve got rules that will help you get your folders cleaned out.

Rule 1: Weekly Cleanup

This rule looks for files and folders in your Downloads (or any) folder that were added before seven days ago. Anything that’s been there less than a week is going to fly under the radar, but if it’s older than that, it’s on Hazel’s hit list.

It’s important to notice that Hazel isn’t looking for files that were last accessed, opened, modified, or created greater than a week ago. No, these files were added to the folder more than a week ago, but they can be two years old or have been opened yesterday. A downloaded application, document, or music file may have been created months ago, but you’ve only just downloaded it, and you don’t want Hazel whisking away that brand-new-to-you file, just because it was technically created more than seven days ago.

This is what a rule to clean out your downloads on a weekly basis might look like.This is what a rule to clean out your downloads on a weekly basis might look like.This is what a rule to clean out your downloads on a weekly basis might look like.
This is what a rule to clean out your downloads on a weekly basis might look like.

So what does Hazel do with all those week-old files it finds? It creates a subfolder within your Downloads folder. The subfolder will be named Weekly Cleanup and prefixed with the current date. All of your files are still there and are accessible, but they’re no longer getting in the way of the newer files you need to access.

Create a subfolder to receive all your older files.Create a subfolder to receive all your older files.Create a subfolder to receive all your older files.
Create a subfolder to receive all your older files.

Rule 2: Monthly Cleanup

If you want your files to stick around in your main Downloads folder a bit longer than a week but still like the idea of a regular cleanout, maybe a monthly rule is more your style. Hazel will search for any files or folders that were added to the monitored folder over four weeks ago.

The monthly cleanout works similarly, but you can customize it however you'd like.The monthly cleanout works similarly, but you can customize it however you'd like.The monthly cleanout works similarly, but you can customize it however you'd like.
The monthly cleanout works similarly, but you can customize it however you'd like.

Similar to the Weekly Cleanup, Hazel will also sort all of the matching files into a Monthly Cleanup folder with a date prefix. Let’s go a bit further with this rule, though, and see what else Hazel can do for us.

Because this stuff has been there for a month and you still haven’t done anything with it, you may need more incentive to actually act on those moved files. Let's give everything a red color label. That looks appropriately dire, right? Of course, it can all be undone in the Get Info window in Finder.

Add a label or use other actions to bring your files to your attention.Add a label or use other actions to bring your files to your attention.Add a label or use other actions to bring your files to your attention.
Add a label or use other actions to bring your files to your attention.

Rule 3: New Files

You may want your newest files brought to your attention, instead, a little heads up from Hazel that you have something new to deal with or to let you know that a download has completed.

Create a new rule requiring all conditions be met for the action to be triggered. The first condition is that the date the file was added to the folder is in the last 1 day. This will grab all of your newest files. If you want to give yourself time to edit or move the file yourself before Hazel takes hold, also add the condition that the date added is not in the last 1 hour. That will give you an hour to move your file from the monitored folder before Hazel acts.

Hazel will monitor your folders for your newest files, too.Hazel will monitor your folders for your newest files, too.Hazel will monitor your folders for your newest files, too.
Hazel will monitor your folders for your newest files, too.

Next you’ll set an action for Hazel to perform on the new file. Probably the easiest is to label the new file with a color, so it will stick out amongst the older stuff, but this action would work best if it were accompanied by another rule that removed the label or changed the label color after twenty-four hours.

Rule 4: Screen Shots

I take a lot of screen shots. I mean, just look at this tutorial. That’s a lot of screen shots. I long ago switched my default folder for screen shots from my Desktop to Downloads, because I was more than a little ashamed of the screen shot cruft, but even so, all those images are crowding out all my downloaded files now. Hazel has an easy fix, though, and it’s not just for screen shots. I’ll show you how to set up the rule and then how to customize it.

My screen shots rule can be customized for just about any filetype.My screen shots rule can be customized for just about any filetype.My screen shots rule can be customized for just about any filetype.
My screen shots rule can be customized for just about any filetype.

Create a new rule, for which all of the conditions must be met for Hazel to perform the action. We’re going to give Hazel a couple of criteria, and it needs to meet them all. First, let Hazel know that the filename needs to start with “Screen Shot.”

Second, the Kind of file should be PNG, or “Portable Network Graphics image” to Hazel. PNG won’t just be listed in the Kind drop-down, though. You’ve have to first select Other, and then go looking for it. There’s a lot in Other, though, so do a search for “Portable,” and that should narrow the field considerably. Double-click on your filetype to get it into your conditions.

There's a lot more in Other than you'll see in the drop-down. Take a look around.There's a lot more in Other than you'll see in the drop-down. Take a look around.There's a lot more in Other than you'll see in the drop-down. Take a look around.
There's a lot more in Other than you'll see in the drop-down. Take a look around.

Once you’ve got your filename and type sorted, choose the Sort Into Subfolder action and create a pattern for the folder name. I use “screen shots” followed by the current date, that way all the screen shots I create each day are sorted chronologically. Now, every time I take a screen shot, it’s immediately slotted into a subfolder automatically.

You can create a subfolder or move your files to a dedicated folder elsewhere.You can create a subfolder or move your files to a dedicated folder elsewhere.You can create a subfolder or move your files to a dedicated folder elsewhere.
You can create a subfolder or move your files to a dedicated folder elsewhere.

If you don’t work so much with screen shots but have lots of files coming in with similar names, just edit the “Screen Shot” condition so that it suits your files. You’ll also change the filetype and add any other conditions to meet your needs. If you don’t see the filetype you need in the Kind drop-down, remember to check in Other.

Rule 5: Import Music into iTunes

I download most of my music from iTunes or Amazon, but occasionally I’ll get a promotional single from a music blog or purchase an album from overseas and have to import it into my iTunes library. If I’m on a music downloading roll, my Downloads folder can get pretty filled up before I bother with importing anything at all. No worries, because Hazel is on the case.

Create a new rule in whichever folder receives your downloaded music. You’re only going to need one condition, “Kind is Music,” because Hazel is just going to be looking for music files. If you want to be more specific, though, you can give Hazel a timeframe or a source.

Easily move your music into an iTunes playlist and then trash it after import.Easily move your music into an iTunes playlist and then trash it after import.Easily move your music into an iTunes playlist and then trash it after import.
Easily move your music into an iTunes playlist and then trash it after import.

Choose the Import into iTunes action, and choose whichever playlist you’d like. I’ve created a Hazel-specific playlist, so I know where all my new music is and can edit any data, like album title or genre, if need be, but you can just import everything directly into Music if you like. If you’re done with your music files, you can move them to the Trash, label them with a color, or create a subfolder to move them into.

Rule 6: Creating Email, Growl, and Notification Center Alerts

Maybe you want more in the way of notification that you’ve got a new file, though. Let’s create an AppleScript that will make you really notice you’ve got a new file hanging around, waiting for you to do something with it. Add the Run AppleScript action to your Hazel rule.

Run AppleScript is right there in your available actions.
Run AppleScript is right there in your available actions.

Select embedded script, click Edit Script, and paste the following into the script window:

1
tell application "Mail"	set theNewMessage to make new outgoing message with properties {subject:"Hello from your Mac!", content:"You got a new file in your Downloads folder, girl!", visible:true}	tell theNewMessage		make new to recipient at end of to recipients with properties {address:"EMAILADDRESS@EMAIL.COM"}		send	end tellend tell

You can edit that as necessary, you know, especially the email address and maybe the sassy “hey girl” shout out in the content of the email, too. That’s up to you, of course.

Your embedded AppleScript will look something like this.Your embedded AppleScript will look something like this.Your embedded AppleScript will look something like this.
Your embedded AppleScript will look something like this.

If you have Growl, or even if you don’t, you can set up Growl notifications similar to the email alerts above, but notifications are even easier and don’t require AppleScript. Instead of Run AppleScript for the Hazel action, choose Display Growl Notification.

Display Growl Notification will work even if you're not running Growl, as long as you have Notification Center.
Display Growl Notification will work even if you're not running Growl, as long as you have Notification Center.

Then just set the pattern you want to use, including any variables you’d like. Whenever the rule is triggered you’ll get a notification, the text of which is based on your rule.

Use the variables in Hazel to customize your notification.Use the variables in Hazel to customize your notification.Use the variables in Hazel to customize your notification.
Use the variables in Hazel to customize your notification.

With Growl on and enabled, you’ll get your regular Growl notifications, but if you don’t have Growl, never fear. Notification Center will take care of it for you. Swing over to Notifications in System Preferences and make sure HazelHelper is in Notification Center. If Hazel tries to throw any notifications up and Growl isn’t around to handle them, Notification Center will take over.

Watch out with these two actions, though. While it’s great for Hazel to let you know whenever it’s doing something, especially something important, if it’s doing something important to fifty files at a time, you’re going to be notified fifty times. If you go the email route, that could end up just the other side of annoying.

If you just want to be notified when you’ve got a new file, though, and you’re only downloading one or two files, that’s not a bad deal. Even better is if you customize the conditions trigger for the rule to only include files with specific names or downloaded from certain senders or URLs, like we'll do next in project-specific rules. Then you can also customize your alert and know when you get a new file named “Cat picture” or download something from www.catpics.tv.

Rule 7: Project-specific Rules

Similar to looking out for files from catpics@catpics.tv, Hazel can also monitor your folders for project@client.com, which is arguably more useful. Rather than looking to meet all of the conditions for the rule you’ll want to choose “any”, on this one, because we’re going to give Hazel lots of options to find our project files.

You can really stack up the conditions here. I think I used five in my example, but you can add as many as you like, since we’re using the “any” operator and won’t be excluding files by including extra conditions.

Organize your project files with Hazel.Organize your project files with Hazel.Organize your project files with Hazel.
Organize your project files with Hazel.

Great conditions for finding project or client files are “name contains KEYWORD” or “contents contain KEYWORD.” Hazel will also be on the lookout for email addresses, URLs, and a whole lot more.

Some things Hazel can do with your project files are move them from the Downloads folder to a project-specific folder or sort them into a subfolder that includes the author’s email address and current date.

Rule 8: Create a New Note in Evernote

Even fancier, you can send your files to Evernote as new notes. This is another AppleScript that will be run as an embedded script, and here’s the code:

1
tell application "Evernote"	activate	create note from file theFile tags {"TAG1", "TAG2”, "TAG3"}end tell
This is what your rule will look like in Hazel.This is what your rule will look like in Hazel.This is what your rule will look like in Hazel.
This is what your rule will look like in Hazel.

The only parts of that you’ll want to change are in all caps. Hazel will create a new note in the Evernote for Mac application based on your files. You can create tags in the rule, but you’ll likely have to create a separate rule for each client or project; otherwise your tags will get confused.

About the only thing you can’t do with this is slot your notes automatically into existing notebooks. If you’re not exact, you’ll just create a new notebook beside the original, and you can easily cause Evernote to lock up and not really do anything at all with your new note if you’re not careful with your notebook creation.

Rule 9: Bills, Bills, Bills

Let’s combine project-specific rules and the new note action to manage bill statements. If you have your statements emailed to you each month or download them yourself, they can really start to pile up if you’re not doing anything with them. Instead, pop them into Evernote, where they’re always there if you need them but won’t be cluttering up your Mac

As in the project-specific rule, create a condition looking out for a source URL or keyword that will match your bill. Using the URL may be good, or a mailing address would work, too.

Next, create the Run AppleScript condition with the “send to Evernote” script pasted into the embedded script field. For your tags you might use the name of whomever you’re paying, the current year, and even a generic “bills.”

Automatically organize all of your bills and statements.Automatically organize all of your bills and statements.Automatically organize all of your bills and statements.
Automatically organize all of your bills and statements.

Once your statement has been moved to Evernote, you can instruct Hazel to move it to the Trash. If you’re not ready to let go, though, Hazel can move it to a “Bills” folder in Documents, label it with a color, or create a subfolder to house it, so you know which statements have been imported.

Be careful with any rule that instructs Hazel to move files to the Trash, though, as Hazel also has a Trash monitoring function. Unless disabled, Hazel will empty your Trash once it hits a certain hugeness. If you’re not ready to part with your files, and Hazel’s got its eye on your Trash, you’ll want to make sure you’re not tossing anything you’re really not ready to part with.

Hazel will manage your trash, be be careful, or you might erase something you may have wanted to hang onto.Hazel will manage your trash, be be careful, or you might erase something you may have wanted to hang onto.Hazel will manage your trash, be be careful, or you might erase something you may have wanted to hang onto.
Hazel will manage your trash, be be careful, or you might erase something you may have wanted to hang onto.

Final Thoughts

The descriptions and screenshots above will help you replicate my favorites rules and create your own. If you just can’t get enough of Hazel, take a look at the Noodlesoft forums, where Hazel users have posted their own rules “recipes” and even even included download links to some for import. Remember to be careful with any new rule, as Hazel is a very powerful tool, but like with any great tool, if you know what you’re doing, Hazel can save you a lot of time and effort.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Computer Skills tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.