PIG Documentation

Install, manage, and build PostgreSQL and its extensions with the pig CLI.

Postgres Install Genius, the missing extension package manager for the PostgreSQL ecosystem

PIG is a command-line tool specifically designed for installing, managing, and building PostgreSQL and its extensions. Developed in Go, it is ready to use out of the box, simple, and lightweight (about 5 MB). PIG is not a reinvented wheel, but rather a PiggyBack - a high-level abstraction layer that leverages existing Linux distribution package managers (apt/dnf). It abstracts away the differences between operating systems, chip architectures, and PG major versions, allowing you to install and manage PG kernels and 562 packaged extensions with just a few simple commands.

PIG is also automation-friendly by design: consistent parameter styles, clear error messages, preview switches like --plan, and confirmation steps.

Please note: for extension installation, pig is not a mandatory component. You can still use apt/dnf package managers to directly access the Pigsty PGSQL repository.

Quick Start

Use the following command to install PIG on your system:

Default Installation (Cloudflare CDN):

curl -fsSL https://repo.pigsty.io/pig | bash

China Mirror:

curl -fsSL https://repo.pigsty.cc/pig | bash

After installation, you can get started with just a few commands. For example, to install PG 18 and the pg_duckdb extension:

$ pig repo set                        # One-time setup for Linux, Pigsty + PGDG repos (overwrites!)
$ pig install pg18                    # Install PostgreSQL 18 kernel (native PGDG packages)
$ pig install pg_duckdb -v 18         # Install pg_duckdb extension (for PG 18)
$ pig install -y postgis timescaledb  # Install multiple extensions for current active PG version
$ pig install -y vector               # You can use extension name (vector) or package name (pgvector)!

Command Reference

Run pig help <command> to get detailed help for subcommands.

Extension Management:

  • pig repo: Manage software repositories
  • pig ext: Manage PG extensions
  • pig build: Build extensions from source
  • pig install: Install PostgreSQL and extension packages through the native package manager

Pigsty Management:

  • pig sty: Manage Pigsty installation and Grafana dashboards
  • pig inventory: Inspect, edit, validate, and exchange the Pigsty inventory
  • pig context: Collect host, PostgreSQL, Patroni, pgBackRest, and extension context
  • pig pg: Manage local PostgreSQL server
  • pig pt: Run patronictl transparently to manage Patroni HA clusters
  • pig pb: Manage pgBackRest backup & restore
  • pig pitr: Point-in-time recovery workflow

About

The pig CLI tool is developed by Vonng (rh@vonng.com) and is open-sourced under the Apache 2.0 license.

You can also check out the PIGSTY project, which provides a complete PostgreSQL RDS DBaaS experience including extension delivery.

  • PGEXT: Extension data and management tools
  • PIG: PostgreSQL package manager
  • PIGSTY: Batteries-included PostgreSQL distribution
Last modified: 2026-08-08: init commit (b7761e8)