Skip to main content
Supported Operating Systems
Windows is not supported. Please use WSL (Windows Subsystem for Linux) or a Linux VM.
  • Linux (AMD64, ARM64)
  • macOS (Apple Silicon)

macOS (Apple Silicon)

Debian/Ubuntu (DEB)

Install pgschema using the DEB package on Debian, Ubuntu, or other Debian-based distributions:
  • AMD64
  • ARM64
# Download the DEB package
curl -LO https://github.com/pgschema/pgschema/releases/download/v1.0.0/pgschema_1.0.0_amd64.deb

# Install the package
sudo dpkg -i pgschema_1.0.0_amd64.deb

# Verify installation
pgschema --help
Replace v1.0.0 and 1.0.0 with the latest release version.

RedHat/Fedora (RPM)

Install pgschema using the RPM package on RedHat, Fedora, CentOS, or other RPM-based distributions:
  • AMD64
  • ARM64
# Download the RPM package
curl -LO https://github.com/pgschema/pgschema/releases/download/v1.0.0/pgschema-1.0.0-1.x86_64.rpm

# Install the package
sudo rpm -i pgschema-1.0.0-1.x86_64.rpm

# Verify installation
pgschema --help
Replace v1.0.0 and 1.0.0 with the latest release version.

Pre-built Binaries (Linux)

For Linux systems without package manager support, download pre-built binaries from the GitHub releases page.
  • Linux AMD64
  • Linux ARM64
# Download the binary
curl -L https://github.com/pgschema/pgschema/releases/download/v1.0.0/pgschema-linux-amd64 -o pgschema

# Make it executable
chmod +x pgschema

# Move to PATH
sudo mv pgschema /usr/local/bin/

# Verify installation
pgschema --help
Replace v1.0.0 with the latest release version.

Docker

Run pgschema using Docker without installing it locally:
# Pull the latest image
docker pull pgschema/pgschema:latest

# Run pgschema commands
docker run --rm pgschema/pgschema:latest --help
# Dump a localhost database (requires --network host)
docker run --rm --network host \
  -e PGPASSWORD=mypassword \
  pgschema/pgschema:latest dump \
  --host localhost \
  --port 5432 \
  --db mydb \
  --schema public \
  --user myuser > schema.sql
# Plan migration and save to plan.json on host
docker run --rm --network host \
  -v "$(pwd):/workspace" \
  -e PGPASSWORD=mypassword \
  pgschema/pgschema:latest plan \
  --host localhost \
  --port 5432 \
  --db mydb \
  --schema public \
  --user myuser \
  --file /workspace/schema.sql \
  --output-json /workspace/plan.json
# Apply changes using the saved plan.json
docker run --rm --network host \
  -v "$(pwd):/workspace" \
  -e PGPASSWORD=mypassword \
  pgschema/pgschema:latest apply \
  --host localhost \
  --port 5432 \
  --db mydb \
  --schema public \
  --user myuser \
  --plan /workspace/plan.json
Important Docker Usage Notes:
  • Use --network host when connecting to databases on localhost/127.0.0.1
  • Mount volumes with -v "$(pwd):/workspace" to access local schema files
  • Files inside the container should be referenced with /workspace/ prefix

Go Install

If you have Go 1.24.0 or later installed, you can install pgschema directly:
go install github.com/pgschema/pgschema@latest
This will install the latest version of pgschema to your $GOPATH/bin directory. After installation, verify that pgschema is working correctly:
# View help and check version
pgschema --help

Build from Source

Clone the repository and build from source:
# Clone the repository
git clone https://github.com/pgschema/pgschema.git
cd pgschema

# Build the binary
go build -v -o pgschema .

# Optional: Install to system
sudo mv pgschema /usr/local/bin/
Building from source requires Go 1.24.0 or later.