MysticMind.PostgresEmbed 5.3.0

dotnet add package MysticMind.PostgresEmbed --version 5.3.0
                    
NuGet\Install-Package MysticMind.PostgresEmbed -Version 5.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MysticMind.PostgresEmbed" Version="5.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MysticMind.PostgresEmbed" Version="5.3.0" />
                    
Directory.Packages.props
<PackageReference Include="MysticMind.PostgresEmbed" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MysticMind.PostgresEmbed --version 5.3.0
                    
#r "nuget: MysticMind.PostgresEmbed, 5.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MysticMind.PostgresEmbed@5.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MysticMind.PostgresEmbed&version=5.3.0
                    
Install as a Cake Addin
#tool nuget:?package=MysticMind.PostgresEmbed&version=5.3.0
                    
Install as a Cake Tool

MysticMind.PostgresEmbed Postgres embedded database equivalent for .Net applications Build status NuGet Version

Run a real PostgreSQL server, extensions included, from .NET code and tests on Windows, Linux (glibc and Alpine/musl) and macOS. No Docker and no local Postgres install required. The library downloads minimal, small sized binaries for your platform once, verifies them, and shares them across every project on the machine.

Documentation: mysticmind.github.io/mysticmind-postgresembed

If you have benefitted from this library and it has saved you a bunch of time, please feel free to sponsor my work!

GitHub Sponsor

Requirements

  • .NET 8 or later (the package targets .NET 8, 9, 10 and 11)
  • Windows x64, Linux x64/arm64 (glibc or musl), macOS x64/arm64. Windows on Arm runs the x64 build under emulation.
  • Postgres refuses to run as root/Administrator, so run your tests as a regular user (this matters in Docker containers)

Getting started

dotnet add package MysticMind.PostgresEmbed
await using var server = new PgServer("17");
await server.StartAsync();

// trust authentication: no password needed
await using var conn = new NpgsqlConnection(server.ConnectionString);
await conn.OpenAsync();

await using var cmd = new NpgsqlCommand("CREATE TABLE books(id int PRIMARY KEY, title text)", conn);
await cmd.ExecuteNonQueryAsync();

The first start downloads the binaries; later starts take about a second. Disposing the server stops it. See Getting Started.

What it does

  • Versions: an exact version (17.6.0) or a spec (17, 17.6, latest) resolved to the newest one published for your platform.
  • Named instances: keep a server and its data between runs; another process, or the pgembed CLI, attaches to it in milliseconds.
  • Downloads and cache: one shared cache per user, checksum-verified downloads, warming the cache ahead of time, progress reports, mirrors.
  • Extensions: the bundled ones, and extension archives the library installs for you.
  • Tests and CI: an xUnit fixture that shares one server, and caching the binaries in CI.

Every option is in the Options reference. Upgrading from v4? See Upgrading to v5. Something not working? See Troubleshooting.

Good to know

  • postgres is the default database and the default superuser.
  • The server listens on localhost only and uses trust authentication: it is made for local development and tests.
  • If the test process exits without disposing the server, the library makes a best effort to kill the server, so tests do not leave Postgres behind.

Acknowledgements

License

MysticMind.PostgresEmbed is licensed under the MIT License. Refer to the License file for more information.

Copyright © 2023-2026 Babu Annamalai

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MysticMind.PostgresEmbed:

Package Downloads
Aero.Cms.Db.Marten

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.3.0 758 11/8/2026
5.2.1 168 11/6/2026
5.2.0 89 11/6/2026
5.1.0 93 11/6/2026
5.0.0 97 11/6/2026
4.0.0 658,693 12/14/2023
3.1.0 21,244 8/30/2023
3.0.1 547 8/13/2023
3.0.0 7,913 8/12/2023
2.1.0 5,409 2/24/2023
2.0.0 7,668 8/30/2022
1.5.0 54,516 8/31/2020
1.4.0 25,015 9/1/2019
1.3.0 5,711 3/15/2019
1.2.0 1,310 2/20/2019
1.1.3 3,182 12/20/2018
1.1.2 1,339 10/8/2018
1.1.1 1,263 9/10/2018
1.1.0 2,490 8/29/2018
1.0.0 2,291 6/28/2018
Loading failed