Dolt is a MySQL-ready database with Git-style branches, diffs, and merges. It lets teams manage data the same way they manage source code, complete with pull requests, conflict resolution, and commit history. Because Dolt ships as an open-source Go project, contributors often build it locally to validate changes before pushing them upstream.
Dolt Gets a cgo Dependency introduced the groundwork for cgo (Go’s built-in bridge for calling C code) dependencies, which means Windows contributors need a predictable
toolchain that ships native headers and libraries alongside Go. Windows complicates that balancing act because the setups for Git,
Go, and our native dependencies do not line up out of the box. We also like to stay anchored to
Git Bash so scripts from our command-line testing guides, like
Run Bats with a Single Click on Windows, behave mostly like on Unix. In this post we follow a similar playbook, showing how we install and use MSYS2 and its pacman package manager to build
Dolt from source without leaving Git Bash.
Why we bet on MSYS2 and pacman#
MSYS2 ships a curated GNU userland, a set of Mingw-w64 toolchains, and a
pacman front-end that feels like the Linux workflow. That combination gives us reproducible compiler and library versions,
and a predictable install location.
Mingw-w64 is the 64-bit Windows port of GCC and the standard C/C++ runtime; it lets us compile native Windows binaries from a Unix-like shell without
installing Microsoft’s Visual Studio toolchain. When we run pacman -S, we are pulling signed packages that match what our
release builders use, so Go’s CGO story and Dolt porting ICU features to Go line up with the binaries we deliver. The MSYS2 project
maintains separate environments for mingw64, ucrt64, and clang64; we standardize on mingw64 for this workflow because it matches the GCC runtime we ship.
Prepare the toolbox#
Clone Dolt into a workspace you control before touching any toolchain steps. I keep mine under
C:\Users\Elian\dolt_workspace\dolt, but any path without spaces works. Getting the repository in place first lets us
verify the Go toolchain against real code later on.
mkdir -p ~/dolt_workspace && cd ~/dolt_workspace
git clone https://github.com/dolthub/dolt.git
If you have other supporting repositories (for example go-mysql-server), clone them next to Dolt now so they inherit
the same workspace layout.
With the sources ready, install MSYS2 to C:\msys64 using the official installer and let it finish its first boot update.

After the installer closes, open the bundled MSYS2 terminal (Start Menu -> MSYS2 MINGW64) so we can bootstrap the rest of the environment. We will come back to Git Bash later to wire up persistent variables.
Update the MSYS2 environment#
In the MSYS2 MINGW64 terminal, run a full system sync so the packages and metadata are current. pacman -Syu is MSYS2’s “update
everything” command: -S selects packages, -y refreshes metadata, and -u upgrades anything that is out of date.
pacman -Syu --noconfirm
When pacman tells you to close the terminal, exit and relaunch the MSYS2 MINGW64 prompt. We then install the packages
that matter for Dolt builds from that same shell. The Mingw-w64 ICU library matches the dynamic libraries we target in release
pipelines, and base-devel plus the Mingw-w64 toolchain provide GNU make, GCC, and the rest of the standard build utilities.
pacman -S --needed --noconfirm base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-icu
Wire up Go for Dolt#
Once MSYS2 has the right packages installed, open Git Bash (C:\Program Files\Git\bin\bash.exe) and confirm the toolchain
paths. We assume you already have the Go SDK installed and on your PATH; our goal here is to expose the Mingw-w64
utilities so CGO can find gcc and make sure Go’s workspace bin directory is visible. The safest way to append these values
permanently is through Windows’ Environment Variables dialog:
- Press
Win + X→ System → Advanced system settings → Environment Variables. - Under User variables, edit Path and add new entries for
C:\msys64\mingw64\binand%USERPROFILE%\go\bin. Leave existing entries untouched.
- Click OK on each dialog, close any open Git Bash sessions, and start a fresh one so the new values take effect.
You can confirm the values with plain shell commands:
$ echo "$GOPATH"
C:\Users\Elian\go
go version
$ which go
/c/Program Files/Go/bin/go
$ which gcc
/c/msys64/mingw64/bin/gcc
$ which dolt
/c/Users/Elian/go/bin/dolt
If which gcc returns /c/msys64/mingw64/bin/gcc and go version reports the SDK you installed earlier, the exports
took effect.
Build Dolt with Go#
The Dolt CLI lives under the go/cmd/dolt package. From Git Bash, step into that directory and confirm that go env GOPATH
still points to the workspace you expect. Once that check passes, go install ./cmd/dolt compiles the CLI and places the binary
into $GOPATH/bin, which we already surfaced on PATH.
cd ~/dolt_workspace/dolt/go
go env GOPATH
go install ./cmd/dolt
If the build finishes cleanly you should see the new dolt binary immediately. When errors mention ICU symbols or headers,
reinstall mingw-w64-x86_64-icu and rerun the command. go env GOBIN and go env GOPATH are handy reminders if you ever
forget where Go stores compiled programs.
$ dolt version
dolt version 1.76.6
Conclusion#
By wrapping MSYS2 inside Git Bash, we keep our Windows workflow close to the Linux instructions in the rest of the Dolt docs while still leaning on Windows. Ready to ship your freshly built binary? Use it as the base layer in the container recipe from Multi-Stage Dockerfiles for Dolt. If you run into issues or find a tweak that improves the setup, join us on Discord; we are always refining the Windows experience and would love your feedback.
