Skip to main content

Getting Started with PreTeXt

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 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.