# Build, test, and package PostgreSQL extensions in Rust with pgrx

> Use pgrx when an agent needs the Rust-native extension lifecycle for PostgreSQL, including local builds, test runs, and packaging across PostgreSQL versions.

- Skill: `agentskillexchange/build-test-and-package-postgresql-extensions-in-rust-with-pg` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentskillexchange/build-test-and-package-postgresql-extensions-in-rust-with-pg`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentskillexchange/build-test-and-package-postgresql-extensions-in-rust-with-pg/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: agentskillexchange (https://skillmd.com/u/agentskillexchange)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/agentskillexchange/build-test-and-package-postgresql-extensions-in-rust-with-pg

---


# Build, test, and package PostgreSQL extensions in Rust with pgrx

Use pgrx when an agent needs the Rust-native extension lifecycle for PostgreSQL, including local builds, test runs, and packaging across PostgreSQL versions.

## Prerequisites

Rust toolchain, PostgreSQL development dependencies, and pgrx

## Installation

Use the upstream install or setup path that matches your environment:
- brew install git icu4c pkg-config
- on the command line before you run cargo pgrx init
- project and the old directory has disappeared. The solution is re-run cargo pgrx init so the
- cargo install --locked cargo-pgrx

Requirements and caveats from upstream:
- † PGRX has no MSRV policy, thus may require the latest stable version of Rust, available via Rustup
- Running PGRX on a Mac requires some additional setup.
- This can be fixed by updating Xcode and the command-line tools. You may require an OS update

Basic usage or getting-started notes:
- cargo pgrx run: Run your extension and interactively test it in psql (or pgcli)
- To fix it, run
- Before anything else, install the [system dependencies](#system-requirements).

- Source: https://github.com/pgcentralfoundation/pgrx
- Extracted from upstream docs: https://raw.githubusercontent.com/pgcentralfoundation/pgrx/HEAD/README.md

## Documentation

- https://github.com/pgcentralfoundation/pgrx

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/build-test-and-package-postgresql-extensions-in-rust-with-pgrx/)

