Skip to content

Uninstall and Clean Up

Remove Linux and macOS VMs deliberately, then clean up integrations, images, networking, and the application.

Use this page to remove part of what Barn created, or all of it. Linux labs and macOS VMs are managed separately, so barn purge never touches Mac VMs. Keep the barn CLI installed until the last step, because the cleanup commands need it.

Choose what to remove

RemoveRunWhat is kept
Nothing yet, just stop the VMsbarn stop; barn mac stop --allEverything, disks included
One Linux nodebarn destroy <node>The other nodes, that node’s persistent disks, keys, images, host network
The Linux labbarn destroyPersistent disks, deployment keys, cached images, host network
The Linux lab, its persistent disks, and keysbarn purge (deletes immediately; --ask to confirm first)Cached images, host network
Named Mac VMsbarn mac destroy <name...> (asks you to confirm)Other Mac VMs, cached macOS images
Barn’s SSH, /etc/hosts, and clock-sync integrationsStep 2Your own ~/.ssh/config and /etc/hosts entries
Cached imagesbarn image prune --yes; barn mac image prune --installers --yesImages a VM still uses, and the default macOS base
The Linux host networkbarn network uninstall --yes (after all Linux VMs are gone)—
Barn itselfStep 5~/.barn, until you delete it

Before destroying anything, check names with barn status (Linux) and barn mac ls (Mac), and copy files you want to keep to the host. What survives each operation has the per-command detail for data disks.

Full teardown steps

  1. Destroy Linux and Mac virtual machines

    Discard the whole Linux lab, persistent disks and deployment keys included:

    barn purge

    It deletes immediately. To review the VM list and scope first, run barn purge --ask and answer y/yes or n/no; purge accepts no --yes, -y, or --force. Then list and destroy any macOS VMs by name:

    barn mac ls
    barn mac destroy mac1 dev
  2. Remove SSH, /etc/hosts, and timer integrations

    Destroying the whole Linux deployment already removes the default ~/.ssh/barn_config integration. Remove anything else you installed: a custom-named SSH fragment, /etc/hosts entries, Mac SSH aliases, or the clock-sync user timer:

    barn ssh-config --remove --name lab
    barn hosts uninstall --json
    barn hosts uninstall --yes
    barn mac ssh-config --remove
    barn time auto disable

    Each command removes only the block Barn wrote.

  3. Prune cached images

    Preview, then delete, cached Linux and macOS images:

    barn image prune --dry-run
    barn image prune --yes
    barn mac image prune --installers
    barn mac image prune --installers --yes
  4. Uninstall Linux host networking

    The shared Linux host network can be removed only while no Linux VM is running. Mac VM networks go away by themselves when each VM stops.

    barn network uninstall --json
    barn network uninstall --yes

    On hosts that use systemd-networkd, the uninstall leaves networkd’s global unit state alone when other links exist or Barn cannot confirm it is the only user; the plan reports preserve_networkd, and the result explains the decision in checks.networkd.

  5. Uninstall the Barn application and remaining state

    If a package manager installed Barn, remove the package:

    Homebrew
    brew uninstall barn
    Debian / Ubuntu
    sudo apt remove barn
    RHEL / Fedora
    sudo dnf remove barn
    • User-scoped install.sh: remove barn, barn-hosts-helper, .barn-current, .barn-releases/, and .barn-install.lock from ~/.local/bin, and the PATH line from your shell rc file.
    • Manual archive or source build: with all Mac guests stopped, remove the extracted release directory, bin/mac, or any copied Barn.app (Barn Mac.app in 0.9.0), plus ~/Library/Preferences/com.pgsty.barn.plist (io.pgsty.barn.mac-runner.plist in 0.9.0).
    • Manually installed hosts helper: if you installed /opt/barn/libexec/barn-hosts-helper by hand and no other user on the host uses Barn, remove it after barn hosts uninstall --yes.
Warning

Delete ~/.barn (or your custom BARN_HOME) only after both Linux and Mac VMs are destroyed. It holds VM state, keys, persistent disks, and base images for both. If a VM is still running or a destroy failed, resolve it with barn status / barn mac ls before deleting the directory.

Table reader