The first RTL patch to bring proper mathematics handling to the Claude Desktop app on macOS. Hebrew, Arabic, Persian, and every other right-to-left script — with LaTeX and KaTeX that stay upright and correct.
Claude Desktop has no right-to-left support at all. If you work in Hebrew, Arabic, or Persian, every long conversation is a struggle — and the moment Claude writes mathematics, it falls apart completely. A rendered formula or an inline $x^2$ dropped into RTL prose gets scattered by naive direction-flipping, and the line becomes unreadable.
*While processing Hebrew with AI agents requires a higher token consumption, it remains the best alternative if language barriers limit your use of English.
Browser extensions solved this for claude.ai in the web browser. Nobody solved it for the desktop app — the official Anthropic request even notes that the Chrome extension "works for web but not desktop," because injecting into Electron through the DevTools protocol fails. The desktop-only patches that do exist just flip whole lines and leave math broken.
Claude-UniMath is the first to bring isolated-math RTL handling to the macOS desktop app.
Hebrew flows right-to-left, every formula stays an upright left-to-right island, code stays LTR.
|
Every other RTL patch answers one question: "is there an RTL character? then align the line right." That breaks on mixed content. Claude-UniMath is built on a different idea — isolation, not line-flipping:
| Other desktop patches | Browser extensions | Claude-UniMath | |
|---|---|---|---|
| Works on the macOS desktop app | ✅ | ❌ | ✅ |
| Math isolated correctly in RTL text | ❌ | ✅ | ✅ |
| Rendered KaTeX and raw LaTeX | ❌ | partial | ✅ |
Currency-aware ($20 ≠ math) |
❌ | ❌ | ✅ |
| Every RTL Unicode script | partial | partial | ✅ |
| Live during streaming | ✅ | ✅ | ✅ |
| Non-destructive (original app untouched) | varies | n/a | ✅ |
| Tested (54 assertions) | ❌ | ❌ | ✅ |
The three ideas no one else implements on desktop (click to expand)
- Math isolation, not line flipping. Each formula becomes a
unicode-bidi: isolateleft-to-right island.הערך העצמי הוא $\lambda = 3$ עם ריבוי $2$renders with the Hebrew flowing right and the formula upright and correct, exactly where it belongs. - Currency-aware LaTeX detection. A bare
$from a price ($20) is never mistaken for math — and, critically, it is never allowed to "steal" the closing delimiter of real math later on the same line.שילמתי $20 עבור $x^2 + 1$isolates only$x^2 + 1$. - Universal RTL coverage. Not just Hebrew and Arabic — every right-to-left Unicode block, including Persian, Urdu, Syriac, Thaana, N'Ko, and astral-plane scripts like Adlam.
It also isolates citation chips and inline UI atoms so they sit on the correct side of an RTL line, handles content live as it streams, and is fully idempotent — re-processing never double-wraps or corrupts anything.
git clone https://github.com/DavidiBellaire/Claude-UniMath.git
cd Claude-UniMath
chmod +x install.sh # only needed if you downloaded the ZIP
./install.sh --installA patched copy is built at ~/Applications/Claude-UniMath.app and launches automatically. Your original /Applications/Claude.app is never touched.
First launch: Gatekeeper & Keychain prompts (both expected)
- Gatekeeper — the copy is ad-hoc signed (not by Anthropic), so macOS may warn on first launch. Right-click the app → Open, or System Settings → Privacy & Security → Open Anyway.
- Keychain — macOS asks to allow access to "Claude Safe Storage". The copy has a different signature than the original, so macOS re-asks once. Safe to approve.
./install.sh --install # Install, or re-apply after a Claude update
./install.sh --uninstall # Remove the patched copy
./install.sh --status # Show install status and fuse state
./install.sh # Interactive menuType or read any RTL language and it aligns automatically. Math stays upright and correct.
- macOS (tested on macOS 15 / macOS 26)
- Claude Desktop at
/Applications/Claude.app - Node.js v16+ (nodejs.org or
brew install node) — providesnpxfor@electron/asarand@electron/fuses - Xcode Command Line Tools (
xcode-select --install) — providescodesign
How it works (the patching pipeline)
The patcher is non-destructive — it never modifies the original app. Instead it:
- Copies
Claude.app→~/Applications/Claude-UniMath.app - Extracts the Electron
app.asararchive - Prepends the Claude-UniMath payload to the renderer JavaScript
- Repacks the archive
- Disables the
EnableEmbeddedAsarIntegrityValidationElectron fuse (required — Electron validates the archive hash at startup and would otherwise refuse to launch the modified copy) - Re-signs the copy with an ad-hoc signature, preserving the original entitlements
Because it builds a separate copy, no sudo is ever needed, your original Claude keeps auto-updating normally, and if anything goes wrong you just delete the copy.
After a Claude update: the auto-updater only touches the original. Re-run ./install.sh --install to rebuild a fresh patched copy from the updated version.
The engine is split so the logic is testable in isolation from Electron:
npm install # installs jsdom (dev dependency) for the DOM tests
npm test # full suite — 54 assertions, 0 failuressrc/core.js is pure and DOM-free. src/payload.js inlines a synchronized copy for runtime injection; the suite verifies the inlined copy matches the module exactly, so they never drift.
Claude-UniMath/
├── install.sh # macOS patcher (copy → inject → repack → sign)
├── assets/
│ └── banner.svg # README banner
├── src/
│ ├── core.js # Pure BiDi + math-detection engine (DOM-free, testable)
│ ├── dom.js # DOM layer: isolates math & inline atoms, sets RTL direction
│ └── payload.js # Self-contained IIFE injected into Claude Desktop
├── test/
│ ├── core.test.js # RTL detection + math segmentation
│ └── dom.test.js # isolation, streaming, idempotency, citation chips
├── package.json
├── LICENSE
└── README.md
"Claude quit unexpectedly" on launch
The ASAR integrity fuse wasn't disabled. Re-run
./install.sh --install. If it persists, confirm npx works: npx --yes @electron/fuses --help.
No RTL alignment
Make sure you're running
Claude-UniMath.app from ~/Applications/, not the original. Check Console.app for [Claude-UniMath] messages.
.vite/build/ not found
A Claude update changed the internal structure. This is the first place to look when a new version breaks the patch.
This patch modifies Claude Desktop's internal files, which Anthropic does not officially support and which may be against their Terms of Service. It is provided as-is, for personal use, with no warranty. Use at your own discretion. The real fix is native RTL support in Claude — if you want that, add your voice to the official request.
MIT © 2026 Davidi Bellaire
