Ways to help
- Share feedback. Tried Grain? Tell us what you think: what you liked, what confused you, what you'd change. Even one line helps.
- Report a bug. Use the bug report form. Include your macOS version, your Mac (Apple Silicon or Intel), what you did and what you expected.
- Suggest a feature. Use the feature request form, and say what you were trying to do, not only the feature you have in mind.
- Improve a cleanup rule. The rules are plain TOML. A missing app, a wrong path or a safer explanation are great first contributions.
- Support it. Grain is free, with no paid version, and it'll stay that way. If it saves you time, you can buy me a coffee. It pays for Apple notarization first, then the time to keep Grain working on new versions of macOS.
- Fix something. Issues labelled good first issue are a good place to start.
Found a security problem? Don't open an issue: report it privately.
Setting up
You need macOS 15 or later, the Command Line Tools and Rust. Xcode isn't needed.
xcode-select --install
rustup target add aarch64-apple-darwin x86_64-apple-darwin
git clone https://github.com/ajayuhjain89/grain.git
cd grain
make doctor # checks everything and picks a macOS SDK
make app # builds build.noindex/Grain.app
For development, create a self-signed code-signing identity named "Grain Development", or you'll have to grant Full Disk Access again after every build. The README's Build and run section explains how.
Where things are
| Folder | What lives there |
|---|---|
core/ | The Rust engine: scanning, the index, accounting, categories, layout, rules, duplicates, relevance, live updates, history and Storage Health |
ffi/ | The UniFFI bridge that gives the engine to Swift |
cli/ | The grain command line tool |
app/ | The SwiftUI app and its tests |
rules/ | Cleanup rules, one TOML file per family |
docs/ | Designs, plans, mockups and measured results |
site/ | This website |
The rule of thumb: anything that touches many files or needs speed goes in Rust. Anything that needs Apple's frameworks goes in Swift.
Before you open a pull request
Run these and make sure they pass:
make lint # formatting, clippy, FFI checks
make test # every Rust and Swift test, then the speed budgets
scripts/app-lint.sh # checks on the Swift code
If you changed anything people see, also run scripts/ui-audit.sh. It opens a real window for a few minutes, so leave the Mac alone while it runs; it must end with no issues.
Ground rules
These keep Grain trustworthy. A pull request that breaks one won't be merged.
Never delete outright
Removing anything goes through the Trash, so Put Back works, and is recorded in the cleanup history.
No network
No telemetry, analytics, update checks, crash reporters or remote rules. Not even optional ones.
Read contents only when a feature needs them
Only the duplicate check and spotting personal files read inside files. Scanning and watching never do.
Never pre-select personal files
Suggestions never tick anything personal or sensitive for removal.
Explain every suggestion
What it is, what removing it does, whether it comes back, and how sure Grain is. Nothing is safe on age alone.
No new unsafe Rust
Not without a very good reason, written down in the pull request.
Adding or changing a cleanup rule
Each rule in rules/*.toml has an id, a title, a match (a path pattern), a safety (safe or review), an explanation, a consequence, comes_back, evidence and stays. Read the comment at the top of a file before adding to it, and give every rule a test: copy a neighbouring rule's.
When in doubt, mark it review. A cautious rule can be relaxed later. A wrong safe costs someone their data.
Style
- Rust:
cargo fmt, and clippy with no warnings. Small functions, errors throughGrainError, no panics on user data. - Swift: Swift 6 with strict concurrency. Views stay thin; logic lives in models you can test.
- Words people see: sentence case, plain and short. Say what something is and what happens next. No exclamation marks, no jargon.
- Commits: the short
type(scope): what changedstyle used in the history, likefix(live): ….
Everyone taking part follows the Code of Conduct. By contributing, you agree your work is licensed under the MIT licence.