I want to run a unison sync service running in the background whenever I login. But the status code of my agent is 78
. I don\'t know why, I tried some fix posted on
I read man launchctl
, find 78 means function not implemented
. It doesn't help much.
Finally I make it work, actually there were errors in the plist, I recommend to install the brew cask install launchcontrol
, which is a gui tool for launchctl, it can help detect errors and trouble shooting.
I found the error had to do with permissions.
I was trying to redirect errors and logs to the /var/log
directory which my user is not able to write to.
Changing the path to something where my user had proper permissions to r+w fixed it.
Also, be careful when loading your LaunchAgents. Do not use sudo to load a plist if you are in the ~/Library/LaunchAgents directory.
Similar to above I was getting a status 78 because I had symlink in my script path. The fix was to use the absolute path.
In my case, script in <ProgramArguments>
is not executable and thus get 78 function not implemented.
Here's what caught me: In Mac OS X you can run shell-scripts from command-line even if there's "just the script" in the file. However, when you run them from launchd you have to tell which binary that should run the script. A suppose that when you run from command-line it just uses the shell you are currently in (in my case bash), but when running from launchd there is no "surrounding script". I added
#!/bin/sh
as the first line in the script file, and then it worked.
I'm keeping getting 78
code for the sake of xml
format issue:
At first, My emacs auto reformat my xml like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>user.eric.g.autosyncdropbox.agent</string>
<key>ProgramArguments</key>
<array>
<string>/Users/eric/G/bin/fswatchG.sh</string>
</array>
<key>KeepAlive</key>
<true />
<key>StandardOutPath</key>
<string>
/Users/eric/.tmp/user.eric.g.autosyncdropbox.out.log</string>
<key>StandardErrorPath</key>
<string>
/Users/eric/.tmp/user.eric.g.autosyncdropbox.error.log</string>
</dict>
</plist>
And I was not able to find these two line is returned...
<string>
/Users/eric/.tmp/user.eric.g.autosyncdropbox.out.log</string>
<key>StandardErrorPath</key>
<string>
/Users/eric/.tmp/user.eric.g.autosyncdropbox.error.log</string>
That was sucks, and absolutely a waste of life...