From 90028519d6dfd95058900a9acb091fe8efd712b5 Mon Sep 17 00:00:00 2001 From: Tommaso Negri Date: Tue, 18 Aug 2026 10:55:14 +0200 Subject: improve the run at login docs --- Sources/bar/bar.docc/run-at-login.md | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'Sources') diff --git a/Sources/bar/bar.docc/run-at-login.md b/Sources/bar/bar.docc/run-at-login.md index 43e7a6c..1a6164b 100644 --- a/Sources/bar/bar.docc/run-at-login.md +++ b/Sources/bar/bar.docc/run-at-login.md @@ -5,24 +5,12 @@ How to start the program automatically at login. It is fine to run `bar` manually while you're editing and customising the source code. Although, as soon as you're happy with your build is a good idea to create a launch agent that can start the program for you. -Copy the example down below in a `plist` file inside the `~/Library/LaunchAgents/` directory. +## Create the agent -> Tip: It is best practice to use [reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) for the filename. - -Adjust the example as you see fit. -For the full file specification run: - -```shell -man launchd.plist -``` - -You can than register the launch agent like so: - -```shell -launchctl load ~/Library/LaunchAgents/house.panini.bar.plist -``` +Copy this code in a `plist` file inside the `~/Library/LaunchAgents/` directory. -### Example +> Tip: It is best practice to use [reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) for the filename. +E.g: `house.panini.bar.plist` ```plist @@ -34,7 +22,7 @@ launchctl load ~/Library/LaunchAgents/house.panini.bar.plist ProgramArguments - ~/.local/bin/bar + [EXECUTABLE_PATH] RunAtLoad @@ -44,10 +32,25 @@ launchctl load ~/Library/LaunchAgents/house.panini.bar.plist StandardOutPath - /tmp/bar/bar.log + /tmp/bar_[USER].out.log StandardErrorPath - /tmp/bar/bar.err + /tmp/bar_[USER].err.log ``` + +Make the two required edits: + +1. Replace `[EXECUTABLE_PATH]` with a path to the `bar` executable. +If you didn't specify a different `PREFIX` in the phase, this should be `~/.local/bin/bar`. + +2. Replace the two `[USER]` placeholders with your actual username. + +## Activate the agent + +You can than register the launch agent like so: + +```shell +launchctl load ~/Library/LaunchAgents/house.panini.bar.plist +``` -- cgit v1.2.3