System-wide AI autocomplete for macOS.
Copilot-style suggestions in every text field — completely offline, private, and on-device.
Website · Quick Start · Why Pretype · Features · How it Works · FAQ · Roadmap · Contributing
Type anywhere → gray ghost text appears at the caret → press Tab to accept a word, or ⇧Tab for the rest.
Note
Pretype runs entirely on your Mac. It uses Apple Silicon MLX with Gemma 4 or the Apple Intelligence system model. Your keystrokes never leave your machine — no subscriptions, no cloud, no tracking.
Most autocomplete solutions live inside a single code editor and ship your text to remote servers. Pretype runs globally across macOS and processes everything locally.
| Feature | Pretype | Cloud Autocomplete |
|---|---|---|
| Privacy | 100% On-Device (keystrokes never leave your Mac) | Sent to a remote server |
| Scope | System-Wide (works in Mail, Slack, Notes, Safari, etc.) | Usually locked to a single IDE / editor |
| Cost | Free & Open-Source (MIT License) | Subscription fees or API token costs |
| Offline | Fully Functional without internet | Requires active internet connection |
| Setup | One-click local model download | Account registration + API key setup |
Pretype is a free, open-source alternative to Cotypist (closed-source, freemium) — a from-scratch reimplementation of the same idea. Not affiliated with Cotypist.
Misspelled words automatically show corrections in a pill above the caret. Press Tab to apply, or Esc to dismiss.
Select any typo-ridden line or phrase and press ⌥Tab. The local LLM rewrites the selection in place while preserving your original tone.
Choose between seamless inline ghost text (pixel-accurate even in Electron) or a clean floating capsule panel above the caret.
- Works Everywhere — Integrates with any macOS text field: native AppKit/SwiftUI apps, Electron apps (VS Code, Slack, Claude Desktop), and web views.
- Pixel-Perfect Ghost Text — completion text is baseline-matched and sized dynamically to match your editor's font.
- Smart Keystrokes — Press Tab to accept the next word, ⇧Tab to accept the rest of the suggestion, or simply type over it to reject. The suggestion renders exactly what one Tab will take a step brighter than the rest.
- Inline Typo Fixes — Misspelled words show an instant correction pill above the word; press Tab to apply (uses native system spell-check, supports English & Russian).
- Smart Rewrites (
⌥Tab) — Select any text and let the local LLM fix grammar, typos, and phrasing in place while preserving your original tone. - Local Inference Engines — Standardized on Gemma 4 via Apple's MLX framework, or Apple Intelligence system models on macOS 26+.
- Zero-Lag completion — Reuses Key-Value (KV) cache to deliver completions in 0.05–0.2 seconds.
- Context Aware & OCR — Intelligently adjusts behavior per app (disabled in terminals). Optional on-screen OCR reads surrounding window context.
- Real Settings, Quiet Menu — The menu bar shows status, stats, and diagnostics; everything tunable lives in a tabbed Settings window (⌘,): presentation & hotkey style, completion style/length, persona & on-device personalization, model choice, and a per-app blacklist.
- Download the latest
Pretype.app.zipfrom Releases. - Unzip and move
Pretype.appto/Applications. - On first launch Pretype picks the Gemma model that fits your RAM and downloads it once from Hugging Face (3.4–8.6 GB).
Note
The app is ad-hoc signed (not notarized yet), so Gatekeeper blocks the first launch. Open it via System Settings → Privacy & Security → Open Anyway, or clear the quarantine flag:
xattr -dr com.apple.quarantine /Applications/Pretype.appImportant
Building requires full Xcode (the MLX engine needs the Metal compiler). The prebuilt app above does not.
# Xcode 26+ only: install the Metal toolchain once
xcodebuild -downloadComponent MetalToolchain
# Clone the repository
git clone https://github.com/nikiomori/Pretype.git && cd Pretype
# Build and run the app bundle
./Scripts/make-app.sh # builds build/Pretype.app
open build/Pretype.appTip
Grant Accessibility when prompted. This permission is how Pretype reads active text fields, catches the Tab key, and types suggestions back. If you grant it after launching, please restart the app.
Dev Loop, Headless Testing & SwiftPM Caveats
For a fast dev loop:
./Scripts/dev.sh # swift build + auto-copies the metallib next to the binary(Requires one prior ./Scripts/make-app.sh run to produce the initial metallib).
[!WARNING] Swift Build Caveat: Plain
swift build/swift runcompiles, but MLX will not work out of the box because SwiftPM cannot compile Metal shaders directly (Failed to load the default metallib). The build scripts handle this by compiling shaders throughxcodebuild. If shaders are missing, Pretype disables the MLX engine gracefully rather than crashing.
When running the raw binary from a terminal, macOS attributes the Accessibility permission to your terminal app. Make sure to grant it to the terminal, or run the .app bundle instead.
Pretype hooks into macOS accessibility APIs to provide a system-wide overlay:
flowchart LR
App[Focused App\nAny text field] -->|AX API Text| FocusTracker
FocusTracker -->|Prompt| MLX[MLX Engine\nGemma 4]
MLX -->|Suggestion| Window[Suggestion Overlay]
Window -->|Ghost Text| App
App -->|Keystrokes| EventTap
EventTap -->|Tab Caught| Injector[Text Injector]
Injector -->|Simulated Keys| App
- FocusTracker tracks the focused text element via
AXObserverand reads the text surrounding the caret on each keystroke. - The CompletionEngine (MLX / Gemma 4, debounced and cancellable) evaluates the context and returns a short continuation.
- SuggestionWindow renders the gray ghost text size- and baseline-matched to the caret.
- A CGEventTap catches completion keys (Tab / ⇧Tab). If accepted, the text is typed back into the active application as synthetic key events.
Engines & Models
Two backends implement the CompletionEngine protocol:
- In-Process MLX Inference (Default): Runs Gemma 4 locally using Apple's
mlx-swift-lmframework. Models are downloaded directly from Hugging Face on first launch. - Apple Intelligence (macOS 26+): Runs the OS-provided system model on the Neural Engine via Apple's Foundation Models framework. Zero RAM footprint.
Variants are automatically selected on startup based on your Mac's installed RAM:
- Gemma 4 E4B 8-bit (≈8.6 GB) — Best quality, default for Macs with ≥32 GB RAM.
- Gemma 4 E4B 6-bit (≈6.8 GB) — Near-best quality, default for 16-32 GB RAM.
- Gemma 4 E2B 8-bit (≈5.7 GB) — Small and precise.
- Gemma 4 E4B 4-bit (≈5 GB) — Compact.
- Gemma 4 E2B 4-bit (≈3.4 GB) — Light footprint, default for Macs under 16 GB RAM.
The default Instruct completion style runs a tuned instruct sibling as the primary model, tiered to RAM the same way (E4B 6-bit on ≥16 GB, 4-bit variants on tighter machines) — no tier ever loads a model it can't comfortably hold.
Typo Corrections & Selection Rewrites
- Inline Typo Fix: Instantly displays the correction in a pill above the misspelled word as you type. Uses the macOS system spell-checker (English + Russian).
- Fix Selection (
⌥Tab): Highlight any text and press⌥Tab. The local LLM rewrites the line in place, preserving tone and punctuation.
Latency & Cache Optimization
- KV-Cache Reuse: Prefills only the newly typed tokens and reuses the existing Key-Value cache.
- Performance: Prefill speed of 400–750 tokens/sec and decode speed of ~90–105 tokens/sec on M-series chips, delivering hot completion latency of 0.05–0.2s.
Context & Vision OCR
- App Awareness: Adapts prompt style based on the active application (e.g., short completions in chats, disabled in terminal emulators).
- Screen Context: Runs Apple's local Vision OCR framework on the focused application's window to pull nearby text (like reading the email thread you are replying to). Requires Screen Recording permission; disabled by default. OCR'd screen text never enters the debug log — exported logs carry a size-only placeholder in its place.
If you don't see any autocomplete suggestions, open Diagnostics in the menu bar icon's menu — its Context section shows what Pretype sees (app, window, field), and Pipeline shows what the completion pipeline last did.
Common Issues & Fixes
Accessibility: NOT granted ✗: If running from a terminal, verify that the terminal has accessibility permissions. If you built the app locally, binary signature changes may confuse macOS permissions. Reset them by runningtccutil reset Accessibility app.pretype.Pretypeand re-grant permissions.Text element: none: The active app does not expose its text boxes via the macOS Accessibility API.Last: engine returned no suggestion: The model chose to remain silent to avoid suggesting irrelevant text. Keep typing.
Is my text ever sent to the cloud?
No. All inference runs on-device — either a local Gemma model via Apple MLX, or the Apple Intelligence system model. Pretype has no accounts, no telemetry, and makes exactly one kind of network request: downloading the model from Hugging Face on first launch.
How is Pretype different from GitHub Copilot or IDE autocomplete?
Copilot lives inside a code editor and sends your code to the cloud. Pretype is a system-wide writing assistant: it completes emails, chat messages, notes, and documents in any macOS text field, and everything stays on your Mac.
Is Pretype a Cotypist alternative?
Yes — Pretype is a free, MIT-licensed open-source alternative to Cotypist, built from scratch around the same idea (system-wide local-LLM autocomplete). It is not affiliated with Cotypist.
Does it work on Intel Macs?
No. MLX requires Apple Silicon (M1 or newer).
Which languages are supported?
Completions inherit Gemma's multilingual ability (English is strongest; Russian and other major languages work well). Inline typo fixes currently support English and Russian via the macOS system spell-checker.
How much RAM do I need?
8 GB is enough — Pretype automatically picks a model variant that fits your machine, from Gemma 4 E2B 4-bit (≈3.4 GB) up to E4B 8-bit (≈8.6 GB) on 32 GB+ Macs.
Why does Pretype need the Accessibility permission?
It's how Pretype reads the focused text field, catches the Tab key, and types accepted suggestions back. Screen Recording is optional and only used for on-screen OCR context (disabled by default).
- Emoji completion (
:shrug:→ 🤷) - Multi-language support overrides
- Per-app compatibility DB and whitelist mode (per-app blacklist already shipped in Settings)
- Sparkle auto-updates, notarized Homebrew builds
- OS: macOS 14+ (macOS 26+ for Apple Intelligence system model)
- Hardware: Apple Silicon Mac (M1/M2/M3/M4 or newer)
- Storage: 3.4–8.6 GB for the local MLX model
- Software: none for the prebuilt app; full Xcode (Metal toolchain) only to build from source
Pretype is young and moving fast — bug reports, feature ideas, and pull requests are all welcome:
- Open an issue for bugs and feature requests
- Read the Contributing Guide and Code of Conduct
- Report security issues privately per SECURITY.md
If Pretype is useful to you, a ⭐ helps others discover it.
- MLX and mlx-swift-lm — Apple's on-device ML stack
- Gemma — the open model family powering completions
- swift-transformers — Hugging Face tokenizers & model hub client
- Cotypist — the original inspiration
Pretype is licensed under the MIT License — free for personal and commercial use.
Built with Swift, MLX, and Gemma — entirely on-device.