pgman Available

A k9s-style terminal UI for PostgreSQL.

For teams whose developers need to reach production databases. Every environment on one screen, guard rails on every statement, migrations applied one checked transaction at a time, masked and encrypted copies of production with a record of each one, and application logs turned back into runnable SQL. Same keys as ebman and k9s: : for commands, / to filter, ? for help.

It works wherever your Postgres runs: your laptop, docker, your own servers, RDS and Aurora, or any managed host that gives you a direct connection. Teams on AWS or the JVM get extras on top.

brew trust tombaldwin/tap
brew install tombaldwin/tap/pgman
pgman --demo

The second box runs it on synthetic data, no database needed. Homebrew older than 6 has no brew trust and doesn’t need it. Cargo and pre-built binaries are under Install.

v0.5.5 · beta · How to upgrade · GitHub · open source, MIT / Apache-2.0

Watch the 86-second overview

Free and open source. Teams that depend on it buy support from £1,500 a year, from the people who build it.

pgman in 86 seconds, with no sound. Every environment, a masked copy of production, migrations, guard rails and your app’s SQL.

What’s inside

  • Every environment Dev, staging and production side by side, from your own list, local docker containers or an AWS account, with replicas under their primary, migration level, lag and drift.
  • Read-only by default Every statement is classified before it runs, a write waits in a transaction until you commit or roll it back, and a project’s config can only tighten your rules.
  • Safe migrations See what is pending and what each patch will change, dry-run it with the real locks and roll back, or rehearse on a throwaway copy, then apply one transaction at a time. Never on a replica.
  • Masked copies of production pgman dump replaces names, emails and phones and removes free text and secrets as rows are read, keeps foreign keys joining, encrypts a protected environment’s copies, and tracks each one until it is deleted.
  • A real editor Completion from the live schema, highlighting, formatting, history and saved queries with parameters. Edit a cell in place, page through a big result, diff two results.
  • DBA panels Schema browser, EXPLAIN as a tree, slow queries, sessions and locks, a schema lint, and a server-config advisor that suggests settings.
  • Logs back into SQL Postgres and RDS server logs, Hibernate, p6spy and datasource-proxy logs or pasted JDBC become runnable queries, with N+1 loops grouped. A live JVM over OpenTelemetry shows its hotspots.
  • For your coding agent pgman mcp serve gives Claude Code read-only queries, EXPLAIN with findings, table descriptions, slow queries, schema diff and lint, plus migrations, dumps and restores you confirm.

Migrations, one checked transaction at a time

pgman reads which patches an environment hasn’t run, plans them read-only, and checks every statement against your guard rails before anything runs. A dry run applies them all in one transaction with the same locks as the real run, lists what they change in the schema, and rolls back. A rehearsal applies them for real to a throwaway copy on the same server. The real run applies each patch in its own transaction with a five-second lock timeout and stops at the first failure. A protected environment’s name is typed first, and nothing is applied to a replica.

A patch that needs one statement past a guard, such as a DROP, says so in a comment above it (-- pgman: allow drop), and confirming it takes the environment’s name typed.

A dry run of staging’s pending migrations: the same locks as the real run, then rolled back.

Any Postgres, any stack

pgman needs nothing but a connection. Everything works on PostgreSQL 10 and newer, PostGIS included, except that slow queries need 12 and pg_stat_statements. TimescaleDB works too, though a masked copy stops at a hypertable for now.

pgman finds connections in a project’s committed .pgman/pgman.toml, your own connections.toml (with an ssh tunnel where one is needed), running docker containers, or a URL on the command line. It reads the migration level that Flyway, Liquibase, Prisma, sqlx, Django, Alembic, Rails and golang-migrate record, so every environment shows how far behind it is.

Every environment on one screen, then v for each database’s migration version across them.

Some teams get more. On AWS, pgman env discover proposes your environments from the account, including Aurora clusters and read replicas, passwords are read from Secrets Manager at the moment of connecting, and connections go through the bastion. On the JVM, pgman reads Spring’s application.yml and IntelliJ’s data sources, turns Hibernate’s logs back into SQL, and with the OpenTelemetry Java agent shows your application’s live queries, their hotspots and N+1 loops.

Point it at a Hibernate log and get the SQL back, with the N+1 loop grouped and the binds filled in, ready to run.

From the command line and CI

The same things run without the TUI, for scripts and pipelines:

  • pgman query --target staging/ledger 'select …' runs one statement against an environment’s database through its secret and ssh tunnel, read-only unless you pass --primary, and always on a protected environment. --batch writes typed JSON or CSV for a script.
  • pgman apply applies an environment’s pending patches, and pgman run runs a script that manages its own transactions.
  • pgman diff staging production reports what differs between two schemas, from tables and columns to indexes, views and functions, and exits 1 when anything does.
  • pgman doctor shows what pgman sees from a directory, each config file and connection and whether it works, without connecting to anything.
  • --redact hides hosts, account IDs and names, for screenshots of a real database.

A copy of production without the personal data

Developers need real-shaped data to reproduce a bug, and a raw copy of production on a laptop is a liability. pgman dump production takes a masked copy by default:

  • Each column is judged from the catalog, by its name and type. Emails, names, phone numbers and IP addresses become realistic fakes, postcodes keep their district, and dates of birth keep their year.
  • Secrets, special-category data, identifiers, addresses and free text are removed, and session and token tables are copied empty.
  • The same value always becomes the same fake within one copy, so foreign keys still join and unique columns stay unique. The key is made for that copy and thrown away.
  • A team commits its own rules for its schema, with a written reason wherever it keeps what the defaults would mask. A developer confirms a new or changed rules file once, seeing what it keeps, and each dump records which rules masked it. pgman masking check tests the rules in CI from the catalog alone.
  • A protected environment’s copies are encrypted as they are written: to a KMS key in the environment’s AWS account, so who may restore one is an IAM decision and each restore is a CloudTrail line, or to a key of your own from pgman key new, unless it says encrypt = "none" for masked copies.
  • Every dump, restore and deletion goes in a journal on the developer’s machine, with its reason, ticket and expiry. For a client’s environment the same events go to a CloudWatch Logs group in the client’s AWS account, under a policy that gives developers no way to delete them. pgman copies lists what is on a machine, pgman copies report gives the whole account, to paste into a ticket, and pgman copies prune deletes what is past its expiry, with the databases restored from it.

A raw copy of a protected environment needs the developer’s own configuration to allow it, the environment’s name typed at a terminal, and a reason. A coding agent working through pgman can take only masked copies of a protected environment. For a client’s data protection officer, what pgman does with personal data sets out what it records and what it does not claim.

What a masked copy does to each column, a dump of production that asks why first, and the same customers in production and in the copy.

Hand your databases to your coding agent

pgman ships an MCP server, listed in the official MCP Registry, so Claude Code or any MCP client works with your databases through the same guard rails you do. Its queries are read-only and capped. It can explain a statement’s plan and suggest an index for a big scan, describe a table, read the slowest statements from pg_stat_statements, diff two schemas, lint a schema, check who holds a lock before a migration, list your environments and read an RDS server’s recent errors.

The tools that write ask you first: applying pending migrations (a dry run or a throwaway copy if you prefer), taking a dump and restoring one into a local database. A restore takes only a dump this machine’s pgman took, checked by its content, and with restore_confirm = "clean_only" an agent can refresh its own local copy into a new database without asking each time. Passwords are read at the moment of use and never reach the agent.

claude mcp add pgman -- pgman mcp serve

Install

Homebrew (macOS / Linux), which brings libpq for pg_dump and pg_restore:

brew trust tombaldwin/tap
brew install tombaldwin/tap/pgman

Homebrew 6 and newer ask you to trust a third-party tap before installing from it, which is the first line. Older versions have no brew trust and don’t need it.

Cargo:

cargo install pgman --locked

From cargo, pgman dump and restore also need PostgreSQL’s client tools: brew install libpq on macOS, apt install postgresql-client on Debian or Ubuntu.

Or a pre-built binary for macOS or Linux:

macOS · Apple Silicon macOS · Intel Linux · x86_64 Linux · arm64

Each has a .sha256 beside it on the Releases page, and a build attestation: gh attestation verify pgman-*.tar.gz --repo tombaldwin/pgman.

Then pgman --demo shows the whole tool on a synthetic billing database.

GitHub · crates.io · open source, MIT / Apache-2.0

Upgrading

The latest version is v0.5.5 (what’s new). pgman --version shows yours, and pgman shows a badge in its header when a newer release exists. It checks crates.io at most once every six hours; --no-update-check turns that off.

pgman --upgrade

That upgrades a Homebrew or cargo install in place. For a pre-built binary it points you to the Releases page for the new one. brew upgrade pgman, or cargo install pgman --locked again, does the same. Afterwards, restart Claude Code or your MCP client so it starts the new pgman mcp serve. If pgman says your pg_dump is older than the server, brew upgrade libpq.

Some upgrades need something from you:

  • From 0.4 or earlier: each protected environment needs encrypt in environments.toml before pgman will dump it. An encrypted raw dump’s link is <label>-latest.pgman-dump, so a script that restores -latest.dump needs changing.
  • Masked copies taken before 0.5.3 can have kept personal columns that 0.5.3 masks, such as a text email_id, born_at, or name on a table of passengers or payees. Take them again: pgman copies lists them, and pgman copies prune or copies rm deletes them with the databases restored from them.
  • Over MCP, restore refuses a .dump file taken before 0.5.3. Restore it at a terminal, or take it again.
  • A masking rules file that keeps more than the defaults has to be confirmed once at a terminal before a dump run without one (in CI, say) will use it, unless the environment is marked unattended.
  • Going back to a version before 0.4: it refuses an environments.toml that uses 0.4’s keys.

The changelog lists every change.

Support plans

pgman is free and open source, with every feature at every level. Teams that depend on it can buy support from the people who build it.

CommunityTeamBusinessEnterprise
Price a yearFreefrom £1,500from £6,000Quoted
Who it’s forTrying it outDaily use by a few engineersRunbooks and change controlRequirements of your own
pgman, in every plan
Every environment on one screen✓✓✓✓
Read-only by default, checked writes✓✓✓✓
Migrations applied safely✓✓✓✓
Masked, encrypted copies of production✓✓✓✓
Logs turned back into SQL✓✓✓✓
Dump and restore, with an audit trail✓✓✓✓
MCP server for coding agents✓✓✓✓
Support
Where to askGitHub issuesPrivate emailPrivate emailAs agreed
Target first replyWhen we can2 business days1 business dayContracted
Your bugs first–✓✓✓
Release warnings–✓✓✓
Rollout help–2-hour call2 days, remoteOn site if you need it
Fixes on a pinned version––Security and critical, 12 monthsAs agreed
Out-of-hours cover–––Available

Prices are per organisation, excluding VAT, and one plan covers both ebman and pgman for any number of people. Release warnings tell you before a release changes something you rely on, and pinned-version fixes are made where practical. What each plan includes

Request a quote

Questions

What is pgman?

A free, open-source terminal UI for PostgreSQL. It shows every database in every environment on one screen, and lets you query them, apply migrations and take masked copies of production behind read-only defaults and guard rails. Its keys follow k9s.

Is pgman safe to use on a production database?

It opens connections read-only by default, sets a statement_timeout, and checks every statement against per-database guard rails before it runs. pgman is in beta, so review your safety.toml before pointing it at production, and connect with a database role scoped to what you need.

Which versions of PostgreSQL does it work with?

PostgreSQL 10 and newer, on your laptop, in docker, on your own servers, or on RDS, Aurora or any managed host that gives you a direct connection. The slow-queries panel needs PostgreSQL 12 and pg_stat_statements.

Can I try it without a database?

Yes. pgman --demo runs the whole tool against a synthetic billing database built into the binary.

What does pgman send anywhere?

Only the database connection, through an ssh tunnel where you’ve set one, the AWS calls you configure (Secrets Manager, KMS, discovery) to your own account, and a check of crates.io for a newer version at most once every six hours, which carries the running version and nothing else and can be turned off. There’s no telemetry, crash reporting or analytics. Journal events go to CloudWatch only for an environment you’ve set up to send them.

Is pgman free?

Yes. It’s open source under MIT or Apache-2.0, at your choice. Teams that want help running it can buy a support plan.

Running pgman across a team? Ask us about support, or about a system of your own.

Get in touch