Installing natively

WARNING: The recommended setup for PrairieLearn development is within Docker. The setup described on this page is not recommended or supported.

This page describes the procedure to install and run PrairieLearn without any use of Docker. This means that PrairieLearn is running fully natively on the local OS.

On OS X these can be installed with MacPorts or Homebrew. On Linux these should all be standard packages from the OS distrbution.

Note that with MacPorts you need to select the active version of PostgreSQL, for example port select postgresql postgresql96.

  • Clone the latest code:
git clone
  • Install the Node.js libraries:
cd PrairieLearn
  • Transpile code in packages/:
make build

# If you're actively working on the code in this directory, you can
# run the following command instead to automatically rebuild the files
# whenever you modify code.
make dev
  • Make sure python3 and python3.6 will run the right version, and make executable links if needed:
python3 --version     # should return "Python 3.6" or higher
python3.6 --version   # should return "Python 3.6" or higher
  • Install the Python libraries:
cd PrairieLearn/images/plbase
python3 -m pip install -r python-requirements.txt
  • Create the database (one time only):
initdb -D ~/defaultdb
  • Run the database:
pg_ctl -D ~/defaultdb -l ~/logfile start
  • Make sure the postgres database user exists and is a superuser (these might error if the user already exists):
psql -c "CREATE USER postgres;"
psql -c "ALTER USER postgres WITH SUPERUSER;"
  • Run the test suite:
cd PrairieLearn
make test
  • Run the linters:
cd PrairieLearn
make lint # or lint-js for Javascript only, or lint-python for Python only
  • Create the file PrairieLearn/config.json with the path of your local course repository and with the path of a directory into which temporary files will be saved when using the in-browser file editor (edit both paths as needed):
  "courseDirs": ["/Users/mwest/git/pl-tam212", "exampleCourse"],
  "filesRoot": "../filesRoot"
  • Run the server:
cd PrairieLearn
node server

This should end with PrairieLearn server ready and will remain running in the foreground, so this terminal can't be used for anything else. Stopping or restarting the server can be done with Crtl-C.