Skip to content

fix(pulse): create ~/Library/LaunchAgents before writing launchd plist#1310

Open
stevetr68 wants to merge 1 commit into
danielmiessler:mainfrom
stevetr68:fix/pulse-manage-launchagents-mkdir
Open

fix(pulse): create ~/Library/LaunchAgents before writing launchd plist#1310
stevetr68 wants to merge 1 commit into
danielmiessler:mainfrom
stevetr68:fix/pulse-manage-launchagents-mkdir

Conversation

@stevetr68
Copy link
Copy Markdown

Problem

PULSE/manage.sh install writes the launchd plist to $HOME/Library/LaunchAgents/:

PLIST_DST="$HOME/Library/LaunchAgents/$PLIST_NAME.plist"
...
sed -e "s|__HOME__|$HOME|g" -e "s|__BUN_PATH__|$BUN_PATH|g" "$PLIST_SRC" > "$PLIST_DST"

…but the install) case only creates state/ and logs/:

mkdir -p "$PULSE_DIR/state" "$PULSE_DIR/logs"

On a fresh macOS user account, ~/Library/LaunchAgents/ does not exist until something
creates it. When it's missing, the > "$PLIST_DST" redirect fails with
No such file or directory, the install aborts, and the user sees a confusing
port 31337 did not bind error with no obvious cause.

Fix

Add "$HOME/Library/LaunchAgents" to the existing mkdir -p. One-line, idempotent,
no behavior change on accounts where the directory already exists.

-    mkdir -p "$PULSE_DIR/state" "$PULSE_DIR/logs"
+    mkdir -p "$PULSE_DIR/state" "$PULSE_DIR/logs" "$HOME/Library/LaunchAgents"

Hit this on a fresh-account PAI 5 install; this exact patch has been running locally
since. Related to the opaque-install-failure reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant