diff --git a/roles/mac/README.md b/roles/mac/README.md
index 59e42f7..8eec0d5 100644
--- a/roles/mac/README.md
+++ b/roles/mac/README.md
@@ -32,8 +32,9 @@ Manages cogitator-02, an Apple Silicon Mac on the tailnet (`mac.yml`,
refuses it without `--force` (hermes-agent #140221).
- **Podman VM** (tag `podman`): a launchd job (`local.podman-machine`) that
starts the VM running Hermes's sandbox at login, and `podman_machine_memory`
- for its size. A resize stops the VM and starts it again through that job
- (a VM started from an Ansible task is stopped when the task ends).
+ for its size. A resize stops the VM and starts it again through that job.
+ The job needs `AbandonProcessGroup`, or launchd kills the VM as soon as
+ `podman machine start` exits.
- **Hermes cron jobs** (tag `hermes-cron`): `hermes_cron_jobs` in
`group_vars/mac/main.yml`, with their scripts from `files/hermes-scripts/`
copied to `~/.hermes/scripts/`. Missing jobs are created; existing ones are
diff --git a/roles/mac/tasks/podman.yml b/roles/mac/tasks/podman.yml
index 45f3f53..73927e4 100644
--- a/roles/mac/tasks/podman.yml
+++ b/roles/mac/tasks/podman.yml
@@ -1,11 +1,17 @@
# The Podman VM runs Hermes's sandbox containers. A launchd job starts it at
-# login, and starts it again after a resize: a VM started from an Ansible task
-# gets stopped when the task ends.
+# login, and starts it again after a resize.
- name: Podman VM launchd job
ansible.builtin.template:
src: podman-machine.plist.j2
dest: "{{ ansible_user_dir }}/Library/LaunchAgents/{{ podman_machine_label }}.plist"
mode: "0644"
+ register: podman_plist
+
+- name: Unload the old Podman VM job definition
+ ansible.builtin.command:
+ argv: [launchctl, bootout, "gui/{{ ansible_user_uid }}/{{ podman_machine_label }}"]
+ when: podman_plist is changed
+ failed_when: false
- name: Check the Podman VM job is loaded
ansible.builtin.command:
diff --git a/roles/mac/templates/podman-machine.plist.j2 b/roles/mac/templates/podman-machine.plist.j2
index ac56de6..9220d2b 100644
--- a/roles/mac/templates/podman-machine.plist.j2
+++ b/roles/mac/templates/podman-machine.plist.j2
@@ -21,6 +21,10 @@
KeepAlive
+
+ AbandonProcessGroup
+
StandardOutPath
{{ ansible_user_dir }}/Library/Logs/podman-machine.log
StandardErrorPath