A Paperless Office Workflow with ScanSnap, Hazel, OCRmyPDF and EagleFilerThis is how I get paper mail from a ScanSnap iX500 into EagleFiler with only one manual step: reviewing each scan. ScanSnap Home only scans and saves. Hazel handles the OCR (with OCRmyPDF), renaming, tagging, date fixing and import into EagleFiler. Names, paths and account details in the screenshots have been replaced with generic ones.
Overview- Scan. The ScanSnap iX500 scans with a dedicated profile and saves a plain PDF, named by scan date, into ~/Desktop/Scan Target/Raw Scans.
- OCR. A Hazel rule on Raw Scans runs OCRmyPDF on the file in place, adds _OCR to the name, and moves it up into ~/Desktop/Scan Target.
- Review. I check the file in Scan Target, rename it so the name starts with the document's own date (its statement or invoice date) instead of the scan date, then drag it into ~/Desktop/Scan Target/Automate-Hazel.
- File. Hazel rules on Automate-Hazel recognize the document by its text. They tag it, set its creation date to the date in its file name, rename it, import it into the EagleFiler library, and trash the original. One-off documents with no rule are named and imported by hand instead.
Why OCRmyPDF instead of ABBYY. ScanSnap setups have long relied on ABBYY FineReader for ScanSnap for OCR, but it is not supported on future Macs or macOS versions. OCRmyPDF (Tesseract under the hood) is faster, has given me better results, runs natively on Apple Silicon and is kept current through Homebrew.
Components and folder layoutThe setup uses four pieces of software and three working folders, all under ~/Desktop/Scan Target.
Software- ScanSnap iX500 + ScanSnap Home: scans and saves a plain PDF, using a dedicated scan profile.
- Hazel: watches folders and runs the rules. Live rules are stored in ~/Library/Application Support/Hazel/
- OCRmyPDF (Homebrew): adds the text layer. Installed at /opt/homebrew/bin/ocrmypdf
- EagleFiler: the final document library, ~/Documents/Paperless-Library_local/Paperless-Library_local.eflibrary
Folders- ~/Desktop/Scan Target/Raw Scans: where ScanSnap drops new scans. Watched by the Hazel rule "OCRmyPDF Engine".
- ~/Desktop/Scan Target: OCRed files wait here for manual review. Not watched.
- ~/Desktop/Scan Target/Automate-Hazel: reviewed files go here to be filed. Watched by the Hazel filing rules (one per document type).
- ~/Desktop/Scan Target/Rules Backup: exported Hazel rules. Not watched.
Step 1: ScanSnap Home profileThe profile's only job is to scan a clean PDF into Raw Scans. ScanSnap does no OCR and sends the file to no app.
In ScanSnap Home, open
Edit profiles and create a profile with these settings:
- Document type: Documents
- Color mode: Automatic
- Scanning side: Duplex
- Image quality: Better
- Rotation: Automatic
- File format: PDF (Single) (*.pdf)
- File name: [Scanned date].pdf
- Feed: Normal scan
- Managing options, Type: Mac (Scan to file)
- Save to: /Users/username/Desktop/Scan Target/Raw Scans
- Application, Send to: None (Scan to file)
Two settings matter more than the rest:
- File name must stay [Scanned date]. ScanSnap writes names like 2026-06-24-16-05-59.pdf. The date script in each filing rule reads the date from fixed character positions in that name, so a different naming format breaks the dates.
- Leave ScanSnap's own OCR off. Under Detailed settings... > File format, keep Convert to Searchable PDF unchecked so OCRmyPDF does all the OCR and the scan isn't processed twice.
The profile as configured:
Step 2: Install OCRmyPDFOCRmyPDF is installed with Homebrew and must end up at /opt/homebrew/bin/ocrmypdf, the path the Hazel rule calls.
- Code: Select all
# Install Homebrew first if it is missing: https://brew.sh
brew install ocrmypdf unpaper
# Confirm the path the Hazel rule expects
which ocrmypdf # should print /opt/homebrew/bin/ocrmypdf
ocrmypdf --version
- unpaper is what the --clean option uses. If Homebrew already installed it with OCRmyPDF, the extra name does nothing.
- OCRmyPDF uses Tesseract, which comes with English. For other languages, run brew install tesseract-lang and add -l eng+spa (for example) to the command.
- To update later, run brew upgrade ocrmypdf.
Step 3: Hazel OCR rule on Raw ScansOne Hazel rule,
OCRmyPDF Engine, makes every new scan searchable and moves it out of Raw Scans for review.
- In Hazel, click Add Folder and choose ~/Desktop/Scan Target/Raw Scans.
- Click New Rule and name it OCRmyPDF Engine.
- Condition: if all of the following are met, Kind is PDF.
- Add these three actions, in this order:
- Run shell script, embedded script, Shell /bin/bash, with the script below.
- Rename with pattern [name]_OCR[extension] (the name token, the literal text _OCR, then the extension token).
- Move to folder Scan Target (~/Desktop/Scan Target).
- Click Save.
The embedded script:
- Code: Select all
/opt/homebrew/bin/ocrmypdf --deskew --clean "$1" "$1"
How the script works:
- $1 is the file Hazel is processing. Giving it as both input and output makes OCRmyPDF replace the scan in place with the searchable version.
- --deskew straightens pages that went through the feeder crooked.
- --clean cleans up the page image before OCR (this uses unpaper), which improves recognition. The saved page image itself is left as scanned.
- The full path to ocrmypdf is used because Hazel scripts don't load your Terminal PATH.
After the rename and move, the file has left Raw Scans, so the rule never runs on the same file twice. A scan named 2026-06-24-16-05-59.pdf arrives in Scan Target as 2026-06-24-16-05-59_OCR.pdf.
The rule and its script in Hazel:

Step 4: Review and re-date in Scan TargetScan Target is the one manual checkpoint. It is also where each file gets its real document date. Nothing goes into EagleFiler until I move it.
Why each file is re-dated by handThe date at the start of the file name becomes the document's creation date in EagleFiler (script A in step 5 reads it). ScanSnap writes the
scan date there, but mail can wait several days before it gets scanned, so the scan date can be days off from the date on the document itself. Renaming the file with the document's own date (its statement, invoice or notice date) means it is filed and sorted under the date that matters.
This step is manual on purpose. I tried finding the date inside documents automatically, but documents vary too much and many carry several dates (statement, due, print, period covered), so the results weren't reliable.
For each _OCR.pdf file in ~/Desktop/Scan Target:
- Open it and check that every page is there, right side up and readable.
- Spot-check the OCR by searching for a word or two (Command-F in Preview).
- If it is bad, delete it and rescan.
- Find the document's own date: the statement, invoice or notice date.
- Rename the file, replacing the YYYY-MM-DD at the start with that date and leaving the rest of the name alone. For example, a statement dated June 18 that was scanned June 24 goes from 2026-06-24-16-05-59_OCR.pdf to 2026-06-18-16-05-59_OCR.pdf.
- Drag it into ~/Desktop/Scan Target/Automate-Hazel.
Keep the name's exact format when you rename: a four-digit year, a two-digit month and day, and hyphens, followed by the original -HH-MM-SS. Script A reads the date from fixed character positions, so a missing zero or a different separator gives a wrong date. If a document has no clear date of its own, leave the scan date as it is.
One-off documents with no filing ruleSome documents are new or one of a kind, so no Hazel rule will recognize them. For these, I type the whole file name during review and import the file into EagleFiler by hand.
- Rename the file to the document date in reversed form (YYYY-MM-DD), followed by a descriptive name. For example: 2026-06-18--Roof Repair Invoice.pdf
- Either leave it in Scan Target or drag it into Automate-Hazel with the rest. No rule will match it, so Hazel leaves it alone.
- Select the file in Finder and press Fn + Option + F1, EagleFiler's capture shortcut.
- In EagleFiler, choose the destination folder and import.
- If the original is still in the Finder folder afterward, delete it.
Because no Hazel rule runs, script A never sets the creation date on one-offs. The file keeps the date it was OCRed, and the date in its name is the record of the document date.
If the same kind of one-off keeps coming back, it's time to give it a rule (see
Adding a new filing rule).
Step 5: Filing rules on Automate-HazelEach filing rule recognizes one kind of document by its OCR text and files it into a set EagleFiler folder. There is one rule per sender or document type (bank statements, utility bills, property taxes, HOA statements, and so on). All the rules follow the same pattern, so an insurance policy rule,
ACME AUTOMOBILE POLICY PACKET, is shown here as the model. "Acme Insurance" stands in for the real insurer.
Add ~/Desktop/Scan Target/Automate-Hazel to Hazel with
Add Folder, then build each rule like this:
- Conditions: if all of the following are met:
- Kind is PDF
- Contents contain match AUTOMOBILE POLICY PACKET (a phrase that appears only in this kind of document)
- Actions, in this order:
- Add tags: @Document, Insurance, Acme
- Run shell script, embedded script, Shell /bin/bash: sets the file's dates from the date in its file name (script A)
- Rename with pattern [date created]--Acme Auto Insurance Policy Packet
- Run AppleScript, embedded script: imports the file into EagleFiler (script B)
- Move to folder Trash
The order matters. The date script has to run before
Rename so that [date created] is the document date, and the original goes to the Trash only after EagleFiler has imported its own copy.
Script A: set the file date from the file nameThis script is the same in every filing rule.
- Code: Select all
#!/bin/bash
# Target: 2026-06-24-16-05-59_OCR.pdf
FILENAME=$(basename "$1")
# Extract date pieces cleanly by character position
# 2026-06-24...
YYYY="${FILENAME:0:4}"
MM="${FILENAME:5:2}"
DD="${FILENAME:8:2}"
HH="${FILENAME:11:2}"
MIN="${FILENAME:14:2}"
# Update the system Creation Date natively on Apple Silicon
# Uses touch -t format: YYYYMMDDhhmm
/usr/bin/touch -t "${YYYY}${MM}${DD}${HH}${MIN}" "$1"
The script takes the year, month, day, hour and minute from fixed positions in the file name. That is the document date set during review, or the scan date if it was left alone. touch -t then sets the modification date to that time. When the new modification date is earlier than the creation date, macOS moves the creation date back to match, so the file ends up with the document date as its creation date. This depends on the file name starting with YYYY-MM-DD-HH-MM, which is why the ScanSnap profile has to keep the
[Scanned date] file name.
Script B: import into EagleFilerThis script changes from rule to rule only in its first two "set" lines, which name the destination folder. Change _libraryPath and _libraryName to match your own library.
- Code: Select all
-- DESTINATION: Documents/Insurance
set _parentFolderName to "Documents"
set _folderName to "Insurance"
set _libraryPath to "/Users/username/Documents/Paperless-Library_local/Paperless-Library_local.eflibrary"
set _libraryName to "Paperless-Library_local.eflibrary"
set _libraryFile to POSIX file _libraryPath
-- Launch EagleFiler and open library if not already open
tell application "EagleFiler"
open _libraryFile
end tell
-- Wait for the library document to be ready, up to 30 seconds
set _timeout to 30
set _elapsed to 0
repeat
delay 1
set _elapsed to _elapsed + 1
tell application "EagleFiler"
try
set _testDoc to library document _libraryName
exit repeat
end try
end tell
if _elapsed ≥ _timeout then
error "EagleFiler library did not open within 30 seconds"
end if
end repeat
-- Import the file into the specified folder
tell application "EagleFiler"
tell library document _libraryName
set _folderRecord to library record _folderName of library record _parentFolderName of root folder
set {_record} to import files {theFile} container _folderRecord
end tell
end tell
- theFile is the file Hazel is processing.
- The script opens the library if EagleFiler isn't running and waits up to 30 seconds for it. If the library isn't ready by then, the script raises an error. Hazel then stops the rule, so the file is not trashed.
- The destination is two levels deep: _folderName inside _parentFolderName at the library's top level (here, Documents/Insurance). Both folders must already exist in EagleFiler.
The model rule and both scripts as they appear in Hazel:


Adding a new filing ruleThe fastest way to add a filing rule is to duplicate an existing rule that goes to a similar EagleFiler folder and change four things.
- In Hazel's Automate-Hazel rule list, right-click a similar rule and choose Duplicate. Rename the copy after the document.
- Contents contain match: pick a phrase that appears in every copy of this document and in no other kind (a form title or an account-type heading works well).
- Add tags: set the tags for this document.
- Rename: keep [date created]-- at the start and change the description text.
- Run AppleScript: change only _parentFolderName and _folderName (and the "-- DESTINATION" comment), and make sure that folder exists in EagleFiler.
- Leave script A and the final Move to Trash as they are.
- Drop a sample into Automate-Hazel, select it, and use Preview Rule to confirm only the new rule matches. Then check that the file landed in the right EagleFiler folder with the right name and date.
If two rules can match the same document, Hazel runs the first matching rule in the list. Make the Contents phrase more specific, or reorder the rules.
Backup, restore and troubleshootingThe Hazel rules hold most of this setup, so keep them exported.
Backup. In Hazel, select a folder, then choose
Action > Export Rules, and save into ~/Desktop/Scan Target/Rules Backup. Do this for both Raw Scans and Automate-Hazel, and again whenever you add or change a filing rule.
Restore on a new Mac.- Install ScanSnap Home, Hazel, EagleFiler and Homebrew, then do step 2.
- Recreate the folders under ~/Desktop/Scan Target and copy over the EagleFiler library.
- In Hazel, add each folder and choose Action > Import Rules, using the backups.
- Recreate the ScanSnap profile (step 1), since ScanSnap Home profiles aren't in these backups.
- Scan a test page and follow it all the way into EagleFiler.
Troubleshooting.- Scans sit in Raw Scans without _OCR. Likely cause: Hazel paused or OCRmyPDF failing. Fix: check Rule Status and Hazel's log, and run the OCR command by hand on the file in Terminal.
- Hazel log says tesseract or gs not found. Likely cause: Hazel's minimal PATH. Fix: add export PATH=/opt/homebrew/bin:$PATH as the first line of the OCR script.
- ocrmypdf not found. Likely cause: Homebrew moved or reinstalled. Fix: run which ocrmypdf, then fix the path in the script.
- OCR error saying the page already has text. Likely cause: ScanSnap's own OCR turned back on. Fix: uncheck Convert to Searchable PDF in the profile.
- File stays in Automate-Hazel. Likely cause: no rule's Contents phrase matched. Fix: use Preview Rule on the file, then add a rule or import it by hand as a one-off (step 4).
- Wrong date in the filed name. Likely cause: file name not in YYYY-MM-DD-HH-MM-SS form. Fix: restore [Scanned date] as the ScanSnap file name, or fix the date typed during review.
- AppleScript error about the library. Likely cause: EagleFiler slow to open, or the library moved. Fix: open EagleFiler first and check _libraryPath.
- AppleScript error about the folder. Likely cause: destination folder missing or renamed in EagleFiler. Fix: create it, or fix _folderName / _parentFolderName.