Uninstall and Clean Up
3 minute read
Barn manages Linux labs and macOS VMs independently. barn purge removes only the Linux deployment—it does not delete Mac VMs. Keep the barn CLI installed until you have finished removing VMs, integrations, cached images, and host networking.
Choose what to remove
| Goal | Command |
|---|---|
| Stop running VMs while keeping disks | barn stop; barn mac stop --all for Mac VMs |
| Delete a single Linux node | barn destroy <node> |
| Delete the Linux lab, keeping persistent disks | barn destroy |
| Delete the Linux lab, persistent disks, and keys | barn purge (deletes immediately; --ask enables confirmation) |
| Delete named Mac VMs | barn mac destroy <name...> (prompts for confirmation) |
Check barn status (for Linux nodes) and barn mac ls (for Mac VMs), and copy any files you want to keep onto the host before destroying machines.
Full teardown steps
-
Destroy Linux and Mac virtual machines
To discard the entire Linux lab—including retained persistent disks and deployment keys—run:
This deletes immediately. Use
barn purge --askto review the VM list and deletion scope, then entery/yesto confirm orn/noto cancel. It accepts no--yes,-y, or--force. If you also created macOS VMs, list and destroy them by name: -
Remove SSH and
/etc/hostsintegrationsWhole-deployment Linux
destroy/purgeremoves the default~/.ssh/barn_configintegration automatically. If you installed a custom named SSH fragment,/etc/hostsentries, or Mac SSH aliases, remove them:These commands remove only Barn’s managed blocks, leaving your personal
~/.ssh/configand/etc/hostsentries intact. -
Prune cached images
Preview and delete cached Linux and macOS images:
-
Uninstall Linux host networking
Preview and remove the shared Linux host network (it stops while any Linux VM is running, so destroy the lab first; Mac VM networks tear down automatically when the VM stops):
When Barn uses systemd-networkd, the uninstall leaves the global networkd unit state unchanged if other host links exist or exclusive Barn use cannot be established; the plan reports
preserve_networkd, and the applied report explains the decision inchecks.networkd. -
Uninstall the Barn application and remaining state
If you installed Barn through a package manager, 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 remove thePATHentry from your shell rc file). - Manual archive or source build: After stopping all Mac guests, 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
/opt/barn/libexec/barn-hosts-helperwas installed manually and no other user on the host uses Barn, remove it after runningbarn hosts uninstall --yes.
- User-scoped
Delete ~/.barn (or your custom BARN_HOME) only after destroying both Linux and Mac VMs. ~/.barn holds active VM state, keys, persistent disks, and base images for both workflows; if a VM is still running or destroy fails, resolve the error with barn status / barn mac ls before deleting the directory.