# Barn documentation

> Install Barn 1.5.0, start a Debian 13 lab and use the matching command and image references.

---

LLMS index: [llms.txt](/v1.5/llms.txt)

---

New Linux labs in **Barn 1.5.0** default to Debian 13. [Changes since 1.4.0](../release/1.5.0/)

## Start here {#start-here}

- [Install Barn 1.5.0](start/installation/) — Use Homebrew, the installer or the signed release checksums to verify a download.
- [Linux Quick Start](start/tutorial/) — Boot one Debian 13 VM, log in, and expand to a four-node lab.
- [Native macOS VMs](start/macos/) — Create a macOS 27 guest on Apple Silicon, open its desktop, or connect over SSH.
{.cards}

Find every command, option, and example in the [Command Reference](reference/commands/). Its [version baseline](reference/commands/#versions) identifies additions across 1.1.0–1.5.0. For a Pigsty lab, follow [Use Barn with Pigsty](start/automation/#pair-the-lab-with-pigsty).

## Common tasks {#common-tasks}

- [Daily operations](start/operations/) — Start, stop, inspect, plan changes, synchronize guest clocks, and recreate Linux lab nodes.
- [Storage and service access](start/storage/) — Add persistent data disks, mount Virtio-9p host shares, and reach guest ports.
- [Image selection](start/images/) — Choose from 9 Linux distribution families, update the catalog, or import custom `qcow2` images.
- [Scripting and automation](start/automation/) — Drive Barn from CI or shell scripts with `--yes`, `--json`, and structured exit codes.
- [Troubleshooting](start/troubleshooting/) — Diagnose host readiness, networking, SSH, and interrupted lifecycle runs with `barn doctor`.
- [What's new in 1.5.0](../release/1.5.0/) — Debian 13 defaults, filename-based image repositories and official signatures.
{.cards}

## Why Barn {#why}

Barn (**Bootstrap And Run Nodes**) runs local virtual machines for development and testing. It does two jobs with one CLI:

- **Linux labs on macOS or Linux.** Describe your machines — names, fixed IP addresses, OS image, CPU, memory, disks — in one Ansible inventory. `barn up` boots them with QEMU and reads each guest’s readiness marker over SSH.
- **macOS VMs on Apple Silicon.** `barn mac up` creates a disposable macOS machine with an admin account, SSH, a desktop window, shared folders, and clipboard sharing.

Barn is open source under Apache-2.0 and built by the [Pigsty](https://github.com/pgsty/pigsty) team; it does not depend on Pigsty.

Software that runs on several machines has to be tested on several machines. A PostgreSQL cluster with Patroni, an etcd quorum, a load balancer with a floating VIP, or an Ansible playbook all expect each node to have its own kernel, disks, and an IP address that its peers can reach across reboots. Containers share the host kernel. Forwarding a port gives the host access to one guest service. A private subnet also lets guests connect directly to one another at fixed addresses.

Barn gives each node a real VM on a private `/24`, at the address your inventory names. Because that inventory is ordinary Ansible YAML, the file that builds the lab is the same file your playbooks run against — Pigsty uses it unchanged. When you are done, `barn destroy` removes the VMs and keeps any persistent data disks. A later `barn up` rebuilds the VMs from the same file.

What you get in practice:

- **Hardware acceleration.** Same-architecture Linux guests normally use HVF on macOS and KVM on Linux. Cross-architecture guests and Rocky Linux 8 arm64 on Apple Silicon use QEMU emulation. [Runtime policy](reference/images/#runtime-policy)
- **Verified images.** Ubuntu, Debian, and Rocky Linux images come from a signed catalog. Barn checks the signature and each file's digest before a VM boots from it.
- **No surprise deletions.** `barn plan` shows what `barn up` will do. Removing a node from the file does not delete its VM, and changing an image does not silently rebuild a disk; removing or replacing a VM takes an explicit `destroy`, `purge` or `recreate`.
- **Scriptable.** Lifecycle and inspection commands accept `--json`, write progress to stderr, and return documented exit codes, so CI jobs and AI agents can drive it without parsing text.

## How a Linux lab works {#how-it-works}

```mermaid
flowchart LR
  inv["barn.yml<br/>Ansible inventory"] -->|barn plan / barn up| barn["barn"]
  barn --> meta["meta<br/>10.10.10.10"]
  barn --> n1["node-1<br/>10.10.10.11"]
  barn --> n2["node-2<br/>10.10.10.12"]
  meta --- lan(("lab subnet<br/>10.10.10.0/24"))
  n1 --- lan
  n2 --- lan
  host["your host"] --- lan
```

- **Desired state is the inventory.** `barn plan` compares `barn.yml` with what is running; `barn up` creates missing nodes and starts stopped ones. Changes that would replace a disk wait for an explicit `barn recreate`.
- **Each node has two network interfaces.** The management interface uses QEMU's built-in NAT for internet access and a loopback SSH port, so no firewall rules are needed. The lab interface carries the fixed address on a host bridge (`socket_vmnet` on macOS, `barn0` on Linux), so nodes and your host reach each other directly. VMs run as your user. Host package installation, network configuration and publishing names to `/etc/hosts` can require `sudo`.
- **Disks are cheap copies.** Each root disk is a thin copy-on-write overlay on a shared, read-only base image, and the default inventory adds a separate data disk at `/data`. A new node costs almost no space until it writes data.
- **State lives in `~/.barn`.** Each user has one lab, stored under `BARN_HOME` (default `~/.barn`), so `barn status` and `barn ssh` work from any directory.

macOS VMs are managed separately: they use Apple's Virtualization framework, each VM gets its own NAT subnet, and their state lives under `$BARN_HOME/mac` (default `~/.barn/mac`). The [design page](about/design/) explains the reasoning behind each of these choices.

## Browse by section {#browse-by-section}

---

Section pages:

- [Guides](/v1.5/docs/start/): Install Barn, boot your first Linux or macOS VM, then run, change, and script your lab.
- [Reference](/v1.5/docs/reference/): Exact syntax, options, defaults, output formats, and file layouts for every part of Barn.
- [Project](/v1.5/docs/about/): Supported platforms, design decisions, security model, contributing, and release records.
