How to Run PostgreSQL Without Docker: miniPG Works Like sqlite3 (No pgvector)
Almost every "run PostgreSQL locally" tutorial starts with docker run postgres . That gives you two dependencies, a daemon and, on a Mac or Windows box, a whole Linux VM, all so a test suite can make a few tables and drop them again. Jeff Lindsay (progrium) shipped another way to run Postgres without Docker last week. miniPG is one executable that embeds the real Postgres 18 server and client,…
Last week, Jeff Lindsay (progrium) introduced miniPG, a single executable that embeds the real Postgres 18 server and client. Unlike other "run PostgreSQL locally" tutorials that involve Docker or a Linux VM, miniPG requires no daemon, container, or additional setup. It works just like sqlite3, where you point it at a path and that path becomes your database.
miniPG offers several advantages. First, it eliminates the need for additional dependencies, making it faster and easier to set up. Second, since it's just files on disk, you can easily back it up, copy it, or delete it when you're done. This simplicity makes it an intriguing local-Postgres tool.
To run miniPG, download the zip file for your platform from the releases page, unzip it, and place minipg (or minipg.exe) on your PATH. On macOS, you may need to remove quarantine attributes using xattr, and on Windows, you'll need to enable the Hypervisor Platform feature. Once installed, you can use miniPG in a similar manner to sqlite3. For example, you can create a table, insert data, and select data using commands like:
minipg ./mydb "create table notes (id serial, body text)"
minipg ./mydb "insert into notes (body) values ('hello')"
minipg ./mydb "select * from notes"
For those who want a normal server running on port 5432, miniPG provides a serve command:
minipg serve ./mydb -p 5432
This command exposes a server on the specified port and uses SCRAM-SHA-256 for authentication, even on loopback connections. The trust option disables passwords for loopback clients, which is ideal for a local tool.
One of the most appealing features of miniPG is its ability to run a command against the database and then exit cleanly, leaving no traces behind. This is particularly useful for self-hosted apps or migration tools that rely on environment variables for configuration. By using minipg run ./mydb -- some-tool, you can execute commands without any additional setup, and the database will be clean up when the command exits.
For testing and AI agents, miniPG offers a straightforward solution. You can create a database per test or use a single .pgdb for the entire suite, with separate databases for each test file. This approach eliminates the need for a full Docker setup and allows you to reason about the database as just files on disk. If you prefer to keep a server running in your shell, you can use the eval "$(minipg env app.pgdb)" command in Bash or Invoke-Expression in PowerShell to set the necessary environment variables.
MiniPG's simplicity and ease of use make it an attractive choice for developers and testers who want a quick, local PostgreSQL environment without the overhead of Docker or other virtualization tools. Although PGlite offers a similar solution, miniPG's design and performance make it a more practical choice for real-world applications.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to