# How to Vibe Code Your Own Hazel (and Stop Paying for It)

> Automated Organization for Your Mac

- Site: https://noodlesoft.com
- Category: Mac Utility
- Platforms: macOS app
- Verdict: **Serious undertaking** (45/100 vibecodeable)
- Estimated effort: 3-4 weeks of focused systems development

## Verdict

Build a simplified folder-watch script yourself for free, but replicating a robust native macOS utility with a graphical rule builder and App Sweep takes weeks of systems programming.

Hazel's value is not a complex UI; it's bulletproof, silent background reliability on macOS. Writing a native macOS app in Swift/SwiftUI using the `FSEvents` API is entirely achievable with an AI coding agent like Claude Code, but handling partial file downloads, Spotlight metadata parsing edge cases, and macOS permission prompts will cause significant friction. Since Hazel costs $42 once and has been refined over 20 years, buying it is the rational choice unless you want a deep dive into macOS systems programming.

### What you can't replicate

- 20 years of battle-tested edge case handling for macOS file system changes
- Frictionless sandboxing and permission management across macOS versions

## What it does

A premier file-organization and automation utility designed exclusively for macOS that watches folders and executes user-defined rules to sort, rename, tag, move, copy, archive, or delete files.

### Core features

- Directory monitoring using macOS FSEvents
- Nested rule engine (if all/any conditions match)
- File metadata and content extraction (Spotlight, PDF text layers)
- File actions: move, copy, rename patterns, tag, script execution
- App Sweep (trash monitoring and orphaned file clean-up)
- Trash management policies (auto-delete aged/oversized items)

## The business

### Pricing

- Single User License: $42.00 — One-time purchase for an individual user.
- Family Pack License: $65.00 — Covers up to 5 members of a private household.

Founded 2006.
Team size: 1 human, 1 dog.

## The hard parts

- Low-level FSEvents monitoring that survives sleep/wake cycles and avoids CPU spikes during rapid bursts
- Partial write handling (detecting when large file downloads are complete before processing)
- Deep macOS sandbox and permissions handling (Full Disk Access entitlements)
- App Sweep heuristic scanning to identify orphaned app support and plist files safely

## How to vibe code Hazel

### Prerequisites

- Mac (existing hardware): Required to build and run native macOS applications
- Xcode (free): Apple's IDE for compiling Swift and SwiftUI native applications
- GitHub (free): Source control repository hosting

### Recommended AI tools

- Claude Code: Best-in-class terminal AI agent for scaffolding multi-file Swift projects and debugging complex asynchronous file system event loops
- Cursor: IDE for inspecting SwiftUI view layouts and refining UI interactions

### Stack

- Frontend: SwiftUI (Native macOS)
- Backend: Swift (CoreFoundation, FSEvents, FileManager)
- Database: SwiftData / SQLite (local rule storage)
- Auth: None (local utility)
- Payments: None (personal clone)
- Other: OSAKit (AppleScript integration), UniformTypeIdentifiers

### Hosting

- None — runs locally (Native macOS application executes locally on user machine): $0/mo

### Build guide

1. **Project Scaffolding & Architecture** — Initialize a native macOS application project in Swift and SwiftUI, setting up clean architecture separation between UI, rule definitions, and the background file monitoring engine.

```
Create a new Swift Package or Xcode project structure for a native macOS menu bar utility named 'MacRuleEngine'. Use Swift 6 and SwiftUI. Establish a modular architecture with targets/folders for: Models (Rule, Condition, Action), Engine (FileWatcher, RuleEvaluator, FileOperations), and UI (SettingsView, RuleEditorView, StatusMenu). Configure the app as a background agent (LSUIElement = true in Info.plist) with a menu bar item. Ensure all file operations use modern Swift async/await patterns and proper error handling with custom error types. Write a set of unit tests for the Rule data model and JSON persistence layer to verify round-trip serialization.
```

2. **Low-Level Directory Monitoring (FSEvents)** — Implement robust directory monitoring using macOS FSEvents API to detect file creation, modification, and deletion events without CPU pinning.

```
Implement a high-performance directory watcher in Swift using the macOS FSEvents C API or DispatchSource. The watcher must accept a list of folder bookmarks (scoped security bookmarks for sandboxing) and stream file system events asynchronously. Implement debouncing logic to handle rapid file creation bursts (e.g., large file downloads writing chunks) so rules only trigger once the file size stabilizes. Handle system sleep/wake notifications to restart or re-establish event streams gracefully. Log all raw events to a local rotating log file for debugging purposes.
```

3. **Rule Evaluation Engine** — Build a recursive rule engine that evaluates file attributes (name, extension, date, size, Spotlight metadata) against user-defined conditions (All/Any of the following match).

```
Build a robust rule evaluation engine in Swift. A Rule consists of a matching mode (.all or .any), an array of Conditions (attribute, operator, value), and an array of Actions. Support attributes: file name, extension, date added, date modified, file size, and Spotlight metadata attributes. Support operators: contains, equals, begins with, ends with, is greater than, matches regex. Implement a dry-run mode that evaluates a file against a rule and returns a detailed trace of which conditions passed or failed. Ensure thread-safe evaluation when multiple file events arrive concurrently.
```

4. **File Action Execution & Safety** — Execute automated actions on matching files (move, copy, rename with pattern tokens, tag, trash) with built-in conflict resolution.

```
Implement the action executor in Swift for file manipulation: move to folder, copy to folder, rename using tokens (e.g., date, original name, sequence), add Finder tags, run shell scripts, run AppleScripts, and move to trash. Handle file name collisions safely by appending numeric suffixes (e.g., 'report (1).pdf') instead of overwriting existing files. Use NSFileCoordinator and file coordination APIs to prevent race conditions with other running applications accessing the same files. Include comprehensive error handling for permission denied or disk full scenarios.
```

5. **Graphical Rule Editor UI** — Create a responsive SwiftUI preferences interface allowing users to configure watched folders, build nested rules, and view execution history.

```
Design and implement a native macOS settings window in SwiftUI for managing watched folders and rules. The interface should feature a sidebar for folders, a central list of rules with drag-and-drop reordering, and an interactive rule editor sheet supporting nested conditions and action configurations with token substitution pickers. Include a live activity/history tab showing a chronological log of recently triggered rules, matched files, and action results with undo options where feasible. Ensure the UI conforms to Apple's Human Interface Guidelines for macOS settings panes.
```

6. **App Sweep & Trash Management** — Implement trash monitoring to detect when applications are moved to the Trash and locate orphaned support files, preferences, and caches.

```
Implement an 'App Sweep' subsystem in Swift that monitors the user's ~/.Trash directory or listens to Finder trash notifications. When an application (.app bundle) is placed in the trash, parse its bundle identifier (from Info.plist) and bundle name. Scan standard macOS system locations (~/Library/Preferences, ~/Library/Application Support, ~/Library/Caches, ~/Library/Logs) for files and folders matching the bundle identifier or app name. Present a native NSAlert or custom SwiftUI confirmation panel to the user listing discovered orphaned files and offering to delete them alongside the application.
```

7. **Permissions, Sandboxing & Polish** — Handle macOS permissions (Full Disk Access, security-scoped bookmarks) and package the application for local distribution.

```
Implement security-scoped bookmark handling in Swift so folder permissions persist across app relaunches. Add a permissions onboarding wizard that checks for Full Disk Access and accessibility privileges, providing clear user guidance and deep links into System Settings. Configure app entitlements, hardened runtime, and code signing parameters for local distribution. Build an automated release script using xcodebuild to archive, export, and package the app into a DMG installer.
```

### Cost vs paying

**Starting costs (one-time):**

- AI Coding Assistant (Claude Pro): $20
- Total: ~$20 one-time

**Ongoing costs (monthly):**

- Total: $0/mo

- Paying for the SaaS instead: $42.00 one-time
- Build time: 40-60 hours
- AI tool credits: $20
- Break-even: N/A (Perpetual software license)

## Sources

- [Noodlesoft Official Website](https://noodlesoft.com)
- [Noodlesoft About Page](https://www.noodlesoft.com/about)
- [Sortio - Hazel Alternative Analysis](https://noodlesoft.com)