whatisgithub

What is mac-ocr?

privatenumber/mac-ocr — explained in plain English

Analysis updated 2026-05-18

102SwiftAudience · developerComplexity · 2/5Setup · easy

In one sentence

A macOS command line tool that reads text out of images and PDFs entirely on your own device using Apple's built in Vision framework, no external server needed.

Mindmap

mindmap
  root((mac-ocr))
    What it does
      Extracts text locally
      Makes searchable PDFs
      Streams page by page
    Tech stack
      Swift
      Apple Vision
      Node.js API
    Use cases
      Document text extraction
      Searchable PDF creation
      AI agent tool use
    Audience
      Developers
      Vibe coders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Extract text from a scanned image or PDF directly in the terminal without any cloud service.

USE CASE 2

Convert a scanned PDF into a searchable PDF with a hidden, selectable text layer.

USE CASE 3

Let an AI coding agent extract text from a document locally instead of paying for a vision API call.

What is it built with?

SwiftNode.jsApple Vision

How does it compare?

privatenumber/mac-ocrdavepl/blinkendisktornikegomareli/aurora
Stars10210199
LanguageSwiftSwiftSwift
Setup difficultyeasymoderateeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires macOS 10.15 or later since it depends on Apple's built in Vision framework.

So what is it?

mac-ocr is a command-line tool for macOS that reads text from images and PDF files. It runs entirely on your computer using Apple's built-in Vision framework, so nothing is sent to an external server. You point it at an image or PDF and it prints the recognized text to your terminal, or saves it to a file. The tool installs via npm, which is the same package manager used for JavaScript projects. You run it as a command in your terminal: pass an image file, a batch of images, or a PDF, and you get the extracted text back. Output can be plain text for simple cases, or JSON if you need details like bounding box coordinates and confidence scores for each word. For PDFs, the tool processes pages and can stream results page by page so you see output from large documents without waiting for everything to finish. A second mode, called searchable-pdf, takes an image or a scanned PDF and produces a new PDF file that looks identical to the original but with a hidden text layer added on top. This means you can open the output in any PDF viewer and select, copy, and search the text inside it. Pages that already have selectable text are skipped by default. The tool also ships a Node.js API for developers who want to call it from code rather than the terminal. You pass file bytes to the ocr function and get back an object with the text and individual word observations. A streaming variant handles multi-page PDFs one page at a time. Supported options include recognition speed versus accuracy trade-offs, custom vocabulary words, a minimum confidence threshold, multiple recognition languages at once, and a region-of-interest flag to restrict recognition to a specific area of the image. The README notes one practical use case beyond normal document work: AI coding agents can run this tool locally to extract text from documents instead of sending images to a vision API, which saves on per-token costs. A bundled skill file lets compatible agents discover and use the tool automatically. The project requires macOS 10.15 or later.

Copy-paste prompts

Prompt 1
Show me the command to convert this scanned PDF into a searchable PDF with mac-ocr
Prompt 2
Explain the difference between the plain text output and the JSON output modes in mac-ocr
Prompt 3
Help me use mac-ocr's Node.js API to extract text from an image inside my own script
Prompt 4
Explain how the region of interest option lets me limit recognition to part of an image

Frequently asked questions

What is mac-ocr?

A macOS command line tool that reads text out of images and PDFs entirely on your own device using Apple's built in Vision framework, no external server needed.

What language is mac-ocr written in?

Mainly Swift. The stack also includes Swift, Node.js, Apple Vision.

How hard is mac-ocr to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is mac-ocr for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.