privatenumber/mac-ocr
macOS CLI for OCR and searchable PDFs using Apple's Vision framework
mac-ocr is a macOS command-line tool that reads text out of images and PDFs using Apple's built-in Vision framework. Everything runs locally on your Mac — no files are uploaded. It can also turn images or scanned PDFs into searchable PDFs (where the text can be selected and searched). It ships as an npm package with a prebuilt universal binary, so no Xcode or Swift toolchain is needed.
Key capabilities:
- OCR from images, PDFs, stdin, or URLs — plain text to stdout, or JSON/JSONL when you need bounding boxes, confidence, or page metadata. PDF pages stream as they're recognized.
- Searchable PDFs —
mac-ocr searchable-pdf scan.pdfwrites a PDF that looks identical but has a selectable text layer.--mergecombines multiple inputs into one PDF, preserving argument order. Pages that already have selectable text are skipped by default (--ocr-all-pagesoverrides). - Partitioned OCR — for large high-resolution pages, auto mode first tries full-page OCR, then recursively splits regions along the longer axis to catch small text the full-page pass missed. Opt out with
--ocr-strategy standard, force with--ocr-strategy partitioned. Partitioned mode can't be combined with--roi; auto skips partitioning when--roiis set. - Recognition options —
--fast(faster, lower accuracy),--passwordfor encrypted PDFs,--language(BCP-47, repeatable),--confidencethreshold,--custom-words/--custom-words-filevocabulary,--no-language-correction,--min-text-height,--pdf-dpi, and--roito restrict recognition to a normalized region. - Output formats — plain text (default),
json(bounding boxes, confidence, page metadata),jsonl(one JSON object per page, streamed for PDFs). - File output —
-oaccepts a file, a directory, or a template with placeholders like[name],[ext],[dir],[page]; templates must be quoted in zsh. Content is always plain recognized text regardless of extension. - Searchable PDFs —
searchable-pdfwrites[name].ocr.pdfby default;--mergecombines multiple inputs into one PDF in argument order; pages with existing selectable text are skipped unless--ocr-all-pages;--ocr-strategy auto|standard|partitionedcontrols partitioned OCR;--roirestricts recognition to a region and disables auto partitioning. - Streaming & memory — PDF pages stream as recognized; output is finalized in a temp file and atomically replaces the destination; stdout and the Node bytes API still buffer the PDF. Stdin and URL inputs are buffered. In an interactive terminal you get a
[page/total]progress counter; piped runs stay silent. - Agent skills — a bundled skill lets AI agents discover and use
mac-ocrcorrectly (see docs/CLI.md).off_topic: false (genuine macOS OCR tool using Apple's Vision framework; relevant to AI agents and document processing, though not a training/inference project per se — it's a local OCR utility that the README explicitly positions as useful for AI agents. It is a real,# mac-ocr — Local OCR for macOS, built for AI agents too 🖼️→📝→🔍📄 (off_topic=false, in scope as a real tool project with AI-adjacent utility: it's a local OCR engine that agents can use instead of vision models, and it's built on Apple's Vision framework — a machine-learning-based OCR system. It's not an LLM project, but it is genuine ML-powered software, not a link list or tutorial, so it's in# mac-ocr — Read text from images and PDFs, right on your Mac, with nothing uploaded to the cloud. It also turns scans into searchable PDFs. It's built on Apple's Vision framework, so it runs 100% locally using Apple's on-device machine learning models. It's useful for AI agents too: instead of spending vision tokens reading documents, an agent can runmac-ocrlocally for free. A skill is bundled so agents know how to use it. It's a command-line tool written in Swift, distributed via npm as a prebuilt universal binary (macOS 10.15+ required, no Xcode needed). It can read text from images and PDFs, stream PDF text page by page, and create searchable PDFs with a hidden text layer. It supports stdin, URLs, multiple files, JSON output with bounding boxes and confidence, custom languages, passwords for encrypted PDFs, and a region-of-interest option. It also has a
Related
- Project
- Project
- Project
- Project
- Project