My plist has below keys:
<key>StandardOutPath</key>
<string>$HOME/launchd.stdout.log</string>
<key>StandardErrorPath</key>
<string>$HOME/launchd.stderr.log</string>
But it doesn't identify $HOME
. What I want is to load this plist in different user accounts as I cant hardcode my user name.
How can I achieve this ultimate aim?
Best Answer
You cannot use $HOME in these keys. You'll need to use the work-around shown in this answer:
how can I use $HOME, ~ or environment variable in plist file of LaunchDaemons
And then use ordinary shell scripting to redirect standard out and standard error to locations within $HOME. I.e. use a command similar to: