跪拜 Guibai
← All articles
Go

Vole: Pure-Go macOS Disk Cleaner That Rechecks Everything Before It Deletes

By 大然Ryan ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

A pure-Go GUI that renders its own UI on the GPU without a browser engine is a concrete alternative for developers weighing Electron or Tauri against native-language frameworks on the desktop. The deletion pipeline's dev/inode checks and TOCTOU guards show what a cleanup tool must do to earn trust on a live system.

Summary

Vole is an open-source macOS disk cleaner built from scratch in pure Go with the mygo framework's native UI mode, which draws the interface on the GPU without a webview or cgo. The packaged app is 22 MB, bundles two command-line tools from the Mole project, and offers treemap disk analysis, nine cleanup categories, app uninstallation, system status monitoring, and a menu bar panel.

Its cleanup engine ports Mole's community-verified rules but hardens them: scanning is read-only, deletion only happens for user-checked items, and each delete re-runs a scan, validates the path is inside the home directory and not behind a symlink, checks dev and inode still match, and skips if the app is running. Auto-rebuilt caches are deleted permanently; user content goes to the trash via renameatx_np with RENAME_EXCL to avoid overwrites. When uv, go, or npm are present, Vole calls their native cleanup commands. App uninstallation reads Info.plist and searches ~/Library by bundle id, defaulting to not touching personal data and asking running apps to quit first.

The author developed Vole with Claude Code despite not having a Go background, having AI read Mole's source to produce research documents while he made scope and safety decisions. The project is GPL-3.0, supports Apple Silicon Macs on macOS 12+, and is not yet notarized.

Takeaways
— Vole is written entirely in Go using mygo's native UI mode, which draws the interface on the GPU without HTML, webview, or cgo.
— The packaged Vole.app is 22 MB, including two bundled Mole command-line tools.
— Cleanup scanning is read-only and only deletes items the user explicitly checks.
— Before each deletion, Vole re-scans, verifies the path is in the home directory and has no symlinked parents, checks dev and inode to prevent TOCTOU races, and skips if the app is running.
— Auto-rebuilt caches are permanently deleted; user content goes to the trash using renameatx_np with RENAME_EXCL to avoid overwriting existing files.
— Vole prefers native cleanup commands from installed tools like uv, go, and npm when they are available.
— App uninstallation reads Info.plist, searches ~/Library locations by bundle id, defaults to not selecting personal data, and asks running apps to quit before force-killing them.
— The author used Claude Code to build Vole despite having no Go background, with AI reading Mole's source and the human owning scope, tradeoffs, and releases.
— Vole supports Apple Silicon Macs running macOS 12 or later and is not yet notarized, requiring manual override on first launch.
— Full Disk Access is recommended, otherwise trash and Safari directories cannot be counted or cleaned.
— The mygo panel positioning bug was fixed by reading mygo's source: the panel only positioned once at creation, so Vole now re-triggers positioning on every popup.
Conclusions

Reusing Mole's cleanup rules as subprocesses rather than reimplementing them from scratch keeps the deletion logic community-verified while the GUI handles user confirmation; Vole compiles Mole's binaries and talks to them over JSON.

The four pre-delete checks (re-scan, path validation, dev/inode comparison, app-running check) are a concrete response to TOCTOU races that most cleanup tools ignore, and that level of caution is appropriate for software touching user data.

A pure-Go immediate-mode GUI framework like mygo can produce a 22 MB app with no browser engine, a clear size advantage over webview-based alternatives, though it comes with a smaller ecosystem and fewer ready-made widgets.

The author's AI-assisted workflow, where Claude Code reads Mole's source to produce research docs and the human makes all scope and safety decisions, reflects a growing pattern: AI handles reimplementation and mechanical work while the developer owns direction and verification.

Concepts & terms
Immediate mode GUI
A UI paradigm where the interface is rebuilt every frame as a function of state, rather than retaining a widget tree. Used by Dear ImGui and egui, it contrasts with retained-mode UI toolkits like React with a virtual DOM.
TOCTOU
Time-of-check to time-of-use, a class of race condition where a resource is verified at one moment but changes before it is used. Vole checks dev and inode before deletion to prevent replacing a file between scan and delete.
Treemap
A data visualization that displays hierarchical data as nested rectangles, where area is proportional to a value such as file size. Vole uses it to show disk space usage by directory.
From the discussion
Featured comments
4545P

Is there a difference from BuhoCleaner?

大然Ryan  · 1 likes

Haven't used it. Mine is focused on lightweight design; the entire installer is only 18M.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗