It is one of our key applications to free up time, eliminate annoying manual tasks, and to make the macOS experience better. It is consistently in the top 10 of our Essential Mac Apps list every year.
What Is Hazel?
Now that we’ve hyped it up, the natural question is: “what the heck is Hazel?”
Noodlesoft, the creators of Hazel, describe it as “Automated Organization for Your Mac”, and that is a great tagline. Here’s what they have to say about it:
Hazel watches whatever folders you tell it to, automatically organizing your files according to the rules you create. Have Hazel move files around based on name, date, type, what site it came from and much more. Automatically sort your movies or file your bills. Keep your files off the desktop and put them where they belong.
Essentially, you tell Hazel to watch a folder (or multiple folders), set some rules you want Hazel to watch for, and when something happens in that folder that matches one of your rules, take some action that you define.
To use the app correctly, you just have to understand very basic if-then logic. In other words:
If X-condition(s) are true, then do Y-action(s).
For example, you can setup rules (as Hazel calls them) like the following:
- If a file is in the Downloads folder and is bigger than 1GB and hasn’t been opened in 2 weeks, then move it to the trash folder.
- If the file name contains “invoice”, then color it green and make a copy in the Finance folder.
- If a file on the Desktop hasn’t been opened in the last 24 hours, move it to a “Desktop To Review” folder.
There are so many ways you setup rules. They can be very simple, or you can have multiple conditions and multiple actions so you can really make it as complex as you want it to be.
You can even have Hazel run shell scripts or Applescripts, so what you can do with your files is almost unlimited. If you don’t know what any of that means, not to worry — no programming is required with Hazel. Anyone can learn it.
What About Hazel For Windows?
Hazel is a Mac application, and there isn’t a Windows version. If you use Windows, there are alternatives. DropIt is a popular open source tool that can do much (but not all) of what Hazel can do. You should be able to do many of the tasks outlined here on Windows with DropIt.
Why Automation Matters
Why use a tool like Hazel at all? Here is a comment from an Asian Efficiency reader that is by no means unusual:
I’ve been trying Hazel for the past few days with the trial, and I just don’t get it. It seems that it’s for people who don’t know what’s going on with their file system. I don’t need something to monitor my download folder and move things to other folders automatically – I move things to where they should go myself. Sorry, I just don’t get it – Hazel causes more problems than it solves IMO…
Many people who try automation tools like Hazel and TextExpander don’t “get it” at first. How hard is it to rename, move, or manipulate a file? How hard is it to type?
At Asian Efficiency, we live by something called the “3 Times Rule.” If something bothers you 3 times, find and implement a permanent solution for it.
This can apply to things that don’t bother you too. If you find yourself doing repetitive tasks manually that could be automated or outsourced, why not find a solution to take it off your plate? Awesome Asian Efficiency reader Scott says it well:
Look for areas in your workflow where you find yourself doing repetitive tasks with files, then see if there is a way to have Hazel help automate that for you so that you can get on with bigger and greater things. It’s not just about maintaining your file system, but also about automating tasks to free up your time and attention.
The value of freeing up time and attention for things that actually matter can’t be overstated.
Hazel Quick Wins
Now that we’ve made the case for Hazel as a tool, let’s look at some quick wins that will get you started.
When you install Hazel, it automatically adds your Downloads folder and installs some sample rules. It’s highly recommended that you poke through those rules and get a feel for how a Hazel rule is set up before starting with your live important files.
If you ever want to get to your Hazel rules, click on the broom icon in your menu bar and choose Open Hazel….
The key thing to know about the Hazel interface is that it is split into two sections: Folders and Rules.
The Folders section on the left is the list of the folders that you want Hazel to watch. To add a folder, drag it into that window from the Finder or click the + button to add it.
The Rules section on the right lists the rules you have set up for the selected folder. Hit the + button to add a new rule or double-click on an existing rule to view/edit it.
Let’s start with a few simple rules.
Clear Off Your Desktop
The Desktop can be a convenient place to temporarily store files, but it can quickly become a cluttered mess. We’re going to create a rule that moves any file that hasn’t been opened in one day to a folder called “Desktop To Review”.
If you’d like, you can have Hazel delete the untouched files, but we’ll be safe and sweep them to a folder to look through later.
First we’ll (1) add the Desktop folder by hitting the + button in the Folders pane or dragging it in. Then, we’ll (2) hit the + button in the Rules pane to add a new rule.
Next, we’ll tell Hazel that we want to:
- Watch for any files that were created more than a day ago
- Ignore folders (we only want to look at files)
We also tell Hazel we want it to:
- Move any of these files to the “Desktop To Review” folder
One we hit OK to save it, here it is in action:
Automatically move and clean up old screenshots
macOS has a handy built-in screenshot feature (if you haven’t tried it yet, hit ⌘-Shift-4, and select part of the screen).
By default, these screenshots they get stored on your desktop. You can delete or move them yourself, but why not let Hazel do it for you so you don’t need to think about it?
If you’d like, Hazel can delete them for you, but I like holding them in a folder (~/Pictures/Screenshots) for a while just in case.
Here’s a rule that will move screenshots older than an hour:
This is great, but now you’ll have a ton of screenshot images in ~/Pictures/Screenshots.
Not a problem. You can make a second rule for Hazel to delete very old screenshots. If you collect all screenshots in a separate folder but never empty it, you’re wasting a lot of space. So make sure you make a new rule for your screenshot folder that deletes files older than, say, 4 weeks.
Add the Screenshots folder to Hazel by pressing on the plus sign in the folders pane (or drag the Screenshots folder in), then add this rule:
Clean Up Your Downloads Folder
Over time your Downloads folder can become a mess and can take up a lot of space. Here are some strategies for taming it.
Remove DMG files
When you download and install a Mac app outside of the App Store, more often than not you will download a DMG file.
Once you install the application, you probably don’t need that DMG file anymore. If you’d like, you can use Hazel to sweep them away to another folder or to an external hard drive. In our case, we’re going to create a rule that deletes them after a day.
Sweep Old Files
Similar to what we did with the Desktop, you can keep your Downloads folder clean by moving old files to another folder for further review, or (if you’re brave) you can delete them.
Follow the instructions for “Clear Off Your Desktop” above, but create the rule for your Downloads folder.
Sort Your Downloads
If you like things to be nice and organized, Hazel can automatically sort files into subfolders for you by criteria like date, extension, or type. Here’s how to keep your downloads folder sorted by type for files older than 1 day.
To select kind, click into the with pattern box. You’ll see you have a number of different options. The date ones can be particularly handy.
Here’s the rule in action:
Highlight Apps You Never Use
How often have you tested out an application on your Mac and then never used it again? This rule will use the handy Set color label feature to highlight the apps we may want to get rid of.
If there’s any application in the /Applications folder that hasn’t been opened in a year, it will turn it purple.
If you then sort your /Applications folder by Tag, you can quickly see which ones should be reviewed. It looks like I have a bit of cleaning to do.
Clean Out Your Trash
Many of us are not the most diligent at cleaning out the Trash in macOS. This is great if you need a file later, but not so great if you want to save hard drive space.
Assuming you have an effective backup system in place, you can have Hazel monitor your Trash and clean it out periodically or when it gets to a certain size. Let’s have Hazel clear out the Trash every two weeks.
This time we won’t be creating a rule, but adjusting a setting. Go to Hazel and go to the Trash tab. Check the Delete files sitting in the Trash for more than checkbox, and set the time period you want to keep files for.
Just remember, once files are gone from the Trash, they’re gone. Be careful with this setting.
Move Saved Email Attachments
Hazel can be a handy tool for archiving files received via email.
If you want to save your important attachments outside of your email program, you can save them to a central folder and then set up rules for Hazel to move your attachments for you.
We wrote about how to handle email attachments, and that article gives an example for doing this.
Hazel Power Moves
We’ve gone through some quick wins you can achieve with Hazel, but it’s time to take things to the next level. Here are some more technical examples of what you can do with Hazel.
Automatically Move Paperless Documents
Hazel is an absolutely killer tool for processing your paperless documents.
We recommend creating a central folder to act as an inbox, and have everything you can and download go to that folder.
Then you can use Hazel to watch that folder and automatically rename and move your PDFs based on the rule you set up.
You can have it move and rename based on the name of the document, but you can even have it look inside the PDF at the contents and move and rename based on text inside the document. It can even grab the date out of the PDF and use that in your file name (!).
We’ve written about using Hazel with your paperless documents before, so check out that detailed tutorial.
That workflow is good, but if you want to make use of the date in the PDF, you’ll need to set a criteria for Contents and then contain match. Choose Custom Date.
We’re creating a token here, and call it stmt date. Use Month, Day and Year to build the pattern that Hazel should look for, but the key is that the pattern must match the date format in your PDF.
For example, if you had a bill with a date that looks like this:
Then your Hazel token would need to look like this:
Things like spaces, slashes, and commas matter. This can be a pain to get right, but once you do it is extremely powerful.
Once you have your token saved, you can use it in the Rename step. Going off the example from our paperless article, here is what the new action section would look like:
Now it will grab the date from the bill, use that date in the name, and rename it with our naming convention and move it. This takes so much of the heavy lifting out of going paperless.
Rename downloaded files
If you download statements, reports, or other files, they are probably not named in the format you want. Fortunately, Hazel can help.
For example, my bank has a report where the downloaded file is named eStatementyyyy-mm-dd.pdf, where yyyy-mm-dd, of course, the date of the report.
I want the file to be named yyyy-mm-dd-XYZ Bank.pdf instead. In plain English, what I want to do is:
Get rid of everything before the date, use the date, and then tack -XYZ Bank after the name.
No problem. There are many ways to do this, but let’s do it the name-manipulation way and do it in a way that we are being extra-safe that it will grab the right file.
Create a new rule and for the criteria, set it to Name and matches. Click into the white matches box and you will see a popup.
In this box we will be telling Hazel to do two things:
- Look for a file named with a certain pattern.
- Grab part of that file name and put it into a token so we can use it later.
First, we want to tell Hazel to look for a name starting with eStatement. Click on the dot beside Custom text. It will open up yet another popup, and this time we want to give our token a name (this one doesn’t really matter) and in the Type text field, I have eStatement. This has to exactly match what we’re looking for in the file.
Next we want to create another token for the part of the filename that contains the date. If we wanted to manipulate that date we could use the Custom Date type, but in this case let’s keep it simple and just use Custom text again. Click on the blue dot beside Custom text.
This time we are going to keep it low tech. We want to tell Hazel that we want it to look for the part of a file that has a number, then a hyphen, then another number, then another hyphen, then another number.
I gave it a name “stmt date”. Hit Done.
Here’s what my Matches popup looks like:
Now that we have our matching done, we’ll tell Hazel to rename the file. For the action, choose Rename and get rid of the part of the filename that says name. We don’t care about the exiting name.
Instead, click on the “stmt date” token we created earlier and then type -XYZ Bank after it. Here’s what my rename pattern window looks like:
Now when I save the rule, Hazel will look for anything named eStatementyyyy-mm-dd and rename it to yyyy-mm-dd-XYZ Bank.
As I mentioned, there are other ways to do this (especially with PDFs), but I wanted to show you the power of tokens and how you can use them to take information from one place and use it in another.
Create new task in OmniFocus when a PDF bill arrives
A common worry when going paperless is making sure bills are paid on time — how can we remember to pay our bills if we don’t see them sitting there?
The Asian Efficient way is to set up auto-pay, but for some bills you can’t or choose not to.
A solution is to set up Hazel to watch a folder for your bills, and then have it create a task in OmniFocus to remind you to pay it.
This can be done with an AppleScript, and here is how to create an OmniFocus hotspot to do just that. There’s even a sample rule included.
The Preview Button Is Your Best Friend
When you are building complex rules it can be helpful to test as you go along. Thankfully, Hazel has a Preview button to help.
Let’s go back to our file-renaming rule from earlier. We’re going to tell Hazel to look at a document that we think should match the rule. We do that by hitting the Preview button.
Once you hit the button, choose the document you want Hazel to watch and hit Open.
Right away you’ll see a green checkmark beside each step that the sample document matches.
If a step doesn’t match, there will be a red x.
You can double-click on one of the red x’s and it will tell you what part doesn’t match and what it sees instead. You then have something to investigate.
Copy Tax Receipts
When you’re downloading a receipt (or you captured it with your phone and uploaded it to Dropbox), you can have Hazel watch a folder, watch for a part of a name, and then move and rename it. This can be handy for tax receipts.
When I am saving a document, I might want it to go to my normal filing system, but I might also want it to go to a Dropbox folder that I share with my bookkeeper. I do that by having a Hazel rule look for anything that has “-taxbd” at the end.
By now this should be pretty standard Hazel for you. Look for a file that’s name ends with some text, and copy it to a folder. The key is that little icon you see in the name attribute in the Rename with pattern box.
When you (1) click on one of the attributes, you have some options. In this case, I (2) chose Replace text.
In this case, I’m telling Hazel to replace -taxbd in the file name with blank text, effectively chopping it off. This way I get the benefits of using this text to tell Hazel to do something without it cluttering up my file names.
Automatically Resize Images
If you are constantly having to resize images to a certain width, you can set up a folder and have Hazel watch it and do the resizing for you.
Now, Hazel itself can’t resize images, but this example shows how the power of Hazel is almost unlimited. We’re going to have it run a shell script and do the resizing for us.
I created a “To 800” folder, and created a Hazel rule that looks for images. I like to put in a safeguard and have it only run if the Pixel Width is greater than 800. Pixel Width isn’t one of the default options. First choose Other… and then scroll down or search. You’ll find it.
Next it’s time to do a tiny bit of scripting. In the action section, choose Run shell script. Then click on Edit script.
Now you have a script window opens up. Paste or type in this command:
sips -Z 800 "$1"
sips is a command built into macOS and $1 is what Hazel will use to substitute in the file it is working for.
Now Hazel will watch for any image you drop into To 800, check if it is greater than 800, and if so run sips to resize it.
(Hat tip to Jacob Salmela for this tip.)
Automatically Import To Evernote
For some reason, the Windows version of Evernote comes with import folder functionality, but Evernote for Mac does not. Never fear though, as a Hazel expert, you can make your own.
We’ll create a To Evernote folder and create a Hazel rule that uses AppleScript to add to Evernote.
Here is, at a high level, our rule:
Now let’s click on Edit script to see the magic.
It’s pretty simple. Here’s the AppleScript code to paste in:
tell application "Evernote" activate create note from file theFile end tell
theFile is Hazel’s placeholder for the file it is processing.
If you have problems with it, sometimes you need to change the first line to:
tell application id "com.evernote.evernote"
You can do a lot more with this, like automatically adding tags or moving it to specific notebooks. Here is Evernote’s AppleScript reference if you want to get really geeky.
Only move non-secure PDFs to Evernote
Sometimes we may want to copy documents or other files to Evernote, but don’t feel comfortable storing sensitive information there. Here is one way you could protect yourself:
This is the same as the last rule, and uses the same AppleScript. But now it has a condition where it will only copy the file to Evernote if it does not contain one of the account numbers listed. You can list social security numbers, credit card numbers, account numbers, or any other sensitive text you wouldn’t want uploaded to Evernote.
What Will You Do With Hazel?
Believe it or not, we are over 3,500 words and we have barely scratched the surface of what Hazel can do.
If all these examples are overwhelming, just pick one to implement, play around, and get to know the tools. You can implement the other ones later if they would help you.
Do you have any killer Hazel workflows you’d like to share? Is there anything you wish you knew how to automate but don’t know how? Leave a message in the comments below.
Discover the 1 Lifehack of Highly Successful People
This one lifehack led to the biggest breakthrough of my career. People like Steve Jobs and Oprah have used it to catapult their success, and now you can too.