Section The Next Level: Installing PreTeXt Locally
At some point you may want PreTeXt running on your own machine rather than in the cloud. Reasons to consider this:
-
You work somewhere with unreliable internet.
-
Youβre drafting a long book and prefer the speed of a local editor.
-
You want to use your favorite editor (Vim, Emacs, BBEdit, something else) instead of the browserβs VS Code.
-
You want to avoid the free-tier Codespace monthly hours.
You donβt need to go local to write great PreTeXt documents, and the Codespaces workflow will carry you a long way. But when youβre ready, the official PreTeXt Guide has a thorough installation chapter at
pretextbook.org/doc/guide/html/tutorial-install.html. There are three supported paths, in rough order of how hands-on they get:
- Docker container (easiest)
-
Install VS Code, install Docker Desktop, and the official PreTeXt Docker image gives you an environment identical to the Codespace but running entirely on your own computer. Needs roughly 5 GB of disk space. Works the same way on Windows, Mac, and Linux.
- Python install via
pip(medium) -
If you already have Python 3.10 or later, a single command (
pip install pretext) gets you the PreTeXt command-line interface. For PDF and Braille output youβll also need LaTeX and (for Braille) Node.js. This is the lightest-weight option if youβre a comfortable Python user. - Developer install (advanced)
-
For contributors to PreTeXt itself, or for very custom setups. Not recommended as a first local install.
Whichever you pick, the source code stays identical. You can move a project between your local install and your Codespace freely through GitHub. Thatβs one of the big payoffs of the version-controlled workflow you set up in Part 7: your work is portable across environments.
