Build from Source
2 minute read
Build Barn yourself to try changes on main before they are released, or to rebuild a release from its tag. To simply use Barn, install a release instead: it needs neither Go nor Xcode, and the Apple Silicon release already includes a signed Barn.app.
Check out the source
This checks out the source for Barn 1.5.0. Omit --branch v1.5.0 to follow development on main.
Build the CLI
You need Go 1.27.4 (pinned in go.mod), Git, Make, and Bash. Compiling needs no QEMU and no host network setup.
An unstamped build reports version dev, and its commit reads uncommitted if the working tree has changes. On the release tag, use BARN_VERSION=1.5.0 make build to stamp the version.
make build writes the CLI and its matching barn-hosts-helper into bin/.barn-releases/ and links them as bin/barn and bin/barn-hosts-helper. Use it instead of go build ./cmd/barn: the CLI embeds the helper’s SHA-256 and runs only a helper that matches. If you move the build, keep bin/.barn-releases/ next to the two links.
To build all four targets (darwin_amd64, darwin_arm64, linux_amd64, and linux_arm64) into bin/<os>_<arch>/, run make cross.
Build the Mac component
On an Apple Silicon Mac running macOS 27 or later, with Xcode 27 or later selected for xcrun, stop any Mac VMs that use a previous local build, then run:
make mac-build puts a matched set in bin/mac/, namely barn, barn-hosts-helper, the standalone barn-mac-runner, and Barn.app, and also writes bin/barn-mac-darwin-arm64.tar.gz. BARN_VERSION stamps it the same way as make build. Run the CLI from bin/mac so it uses the Barn.app built with it.
The build is ad-hoc signed, which is all you need to run VMs on your own Mac. Developer ID signing and notarization are part of the release procedure. Continue with the macOS guide to create a VM.
Run the tests
Before opening a pull request, run the full make check gate with the pinned linters. Contributing lists the tools and what each target covers.