Skip to content
Robert Sachunsky edited this page May 17, 2024 · 6 revisions

Using OCR-D on macOS

OCR-D can be used on macOS. It requires additional software which is provided for example by Homebrew.

Preconditions

The installation was tested on the latest version of macOS Big Sur. It requires lots of free disk space (more than 10 GiB).

Running OCR-D tools on macOS

Install Xcode command line tools and Homebrew first.

Installation of Homebrew and required software packages

Installation of Homebrew is described at https://brew.sh/ and https://docs.brew.sh/Installation. A single command is needed:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Homebrew installs python3.12 or newer by default, but the different versions of Tensorflow which are used by the OCR-D processors are only available for python3.8. Therefore python3.8 must be installed explicitly:

brew install "[email protected]"

If python3.12 was already installed before, a symbolic link /usr/local/bin/python3.8 must be added manually after the installation of python3.8.

In addition several other packages must be installed with Homebrew (tbd, list incomplete).

# Required by ocrd_olena.
brew install imagemagick

Installation of XCode command line tools

The installation is started by running xcode-select --install.

Installation of OCR-D tools

The installation uses OCR-D/ocrd_all and is similar to the installation on a native Linux distribution. Start with these commands from the shell:

mkdir -p $HOME/src/github/OCR-D
cd $HOME/src/github/OCR-D

# Get OCRD/ocrd_all.
git clone https://github.com/OCR-D/ocrd_all.git

cd $HOME/src/github/OCR-D/ocrd_all

# Use Python 3.8 to create a virtual environment.
# Activate that environment before running make.
python3.8 -m venv $HOME/src/github/OCR-D/ocrd_all/venv
source $HOME/src/github/OCR-D/ocrd_all/venv/bin/activate

# Build the OCR-D tools. This takes some time.
make all PKG_CONFIG_PATH=/usr/local/Cellar/icu4c/66.1/lib/pkgconfig:/usr/local/Cellar/libarchive/3.4.2_1/lib/pkgconfig

Each command should work without showing an error message. Activate the virtual Python environment with all OCR-D tools:

source $HOME/src/github/OCR-D/ocrd_all/venv/bin/activate

Now you are ready to run the OCR-D tools. Try to run one of them:

ocrd --help

Congratulation if that works. You are now ready to use the OCR-D tools. Each time when you open a new shell and want to work with OCR-D tools and before running make, you must activate the virtual Python environment again:

source $HOME/src/github/OCR-D/ocrd_all/venv/bin/activate

Welcome to the OCR-D wiki, a companion to the OCR-D website.

Articles and tutorials
Discussions
Expert section on OCR-D- workflows
Particular workflow steps
Recommended workflows
Workflow Guide
Videos
Section on Ground Truth
Clone this wiki locally