Uninstall and Clean Up
3 minute read
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
| Remove | Run | What is kept |
|---|---|---|
| Nothing yet, just stop the VMs | barn stop; barn mac stop --all | Everything, disks included |
| One Linux node | barn destroy <node> | The other nodes, that node’s persistent disks, keys, images, host network |
| The Linux lab | barn destroy | Persistent disks, deployment keys, cached images, host network |
| The Linux lab, its persistent disks, and keys | barn purge (deletes immediately; --ask to confirm first) | Cached images, host network |
| Named Mac VMs | barn mac destroy <name...> (asks you to confirm) | Other Mac VMs, cached macOS images |
Barn’s SSH, /etc/hosts, and clock-sync integrations | Step 2 | Your own ~/.ssh/config and /etc/hosts entries |
| Cached images | barn image prune --yes; barn mac image prune --installers --yes | Images a VM still uses, and the default macOS base |
| The Linux host network | barn network uninstall --yes (after all Linux VMs are gone) | — |
| Barn itself | Step 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
Destroy Linux and Mac virtual machines
Discard the whole Linux lab, persistent disks and deployment keys included:
It deletes immediately. To review the VM list and scope first, run
barn purge --askand answery/yesorn/no;purgeaccepts no--yes,-y, or--force. Then list and destroy any macOS VMs by name:Remove SSH,
/etc/hosts, and timer integrationsDestroying the whole Linux deployment already removes the default
~/.ssh/barn_configintegration. Remove anything else you installed: a custom-named SSH fragment,/etc/hostsentries, Mac SSH aliases, or the clock-sync user timer:Each command removes only the block Barn wrote.
Prune cached images
Preview, then delete, cached Linux and macOS images:
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.
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 inchecks.networkd.Uninstall the Barn application and remaining state
If a package manager installed Barn, remove the package:
HomebrewDebian / UbuntuRHEL / Fedora- User-scoped
install.sh: removebarn,barn-hosts-helper,.barn-current,.barn-releases/, and.barn-install.lockfrom~/.local/bin, and thePATHline from your shell rc file. - Manual archive or source build: with all Mac guests stopped, remove the extracted release directory,
bin/mac, or any copiedBarn.app(Barn Mac.appin0.9.0), plus~/Library/Preferences/com.pgsty.barn.plist(io.pgsty.barn.mac-runner.plistin0.9.0). - Manually installed hosts helper: if you installed
/opt/barn/libexec/barn-hosts-helperby hand and no other user on the host uses Barn, remove it afterbarn hosts uninstall --yes.
- User-scoped
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.