Skip to main content


PostgreSQL can be automatically configured by Devbox via the built-in Postgres Plugin. This plugin will activate automatically when you install Postgres using devbox add postgresql

Example Repo

Open In

Adding Postgres to your Shell

devbox add postgresql glibcLocales, or in your devbox.json, add

    "packages": [

PostgreSQL Plugin Support

Devbox will automatically create the following configuration when you run devbox add postgresql:


  • postgresql

You can use devbox services start|stop postgresql to start or stop the Postgres server in the background.

Environment Variables

PGHOST=./.devbox/virtenv/postgresql PGDATA=./.devbox/virtenv/postgresql/data

This variable tells PostgreSQL which directory to use for creating and storing databases.


To initialize PostgreSQL run initdb. You also need to create a database using createdb <db-name>