Fix daemon startup when --user changes, and document service accounts

launchd opens StandardOutPath/StandardErrorPath as the service user. Re-running
install.sh with a different --user leaves those files owned by the previous
one, so the job fails to start -- and since it never gets far enough to write
anything, the log gives no clue why. Chown them before bootstrapping.

README now documents the full dedicated-service-account setup, including the
two things that are easy to get wrong: macOS home directories are drwxr-x--- so
the checkout has to live outside one, and the HuggingFace cache follows HOME so
it has to move with the service user.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 03:52:36 +01:00
co-authored by Claude Opus 5
parent 0889d2bf02
commit 128c174672
2 changed files with 32 additions and 1 deletions
+8
View File
@@ -162,6 +162,14 @@ cat > "$TMP_PLIST" <<EOF
EOF
plutil -lint "$TMP_PLIST" >/dev/null || die "generated plist is malformed"
# launchd opens the log paths as the service user. If they already exist owned
# by someone else -- which is exactly what happens when you re-run with a
# different --user -- the job fails to start, and because it never gets far
# enough to write anything, the log gives no clue why.
for log in "/tmp/$LABEL.stdout" "/tmp/$LABEL.stderr"; do
[[ -e "$log" ]] && sudo chown "$SERVICE_USER" "$log"
done
sudo cp "$TMP_PLIST" "$PLIST"
sudo chown root:wheel "$PLIST"
sudo chmod 644 "$PLIST"