I've been building a golang app with system tray GUI. I wanted launchctl
to run my program whenever I log in. Program compiles and runs without any error, however, when launchctl
runs it, I see this: Service exited with abnormal code: 78
. Perhaps it has something to do with rights.
First I tried to set rights of a current user to both
plist
file and the binary. Still error78
.Then I changed the rights of
plist
file and the binary to root and runsudo launchctl
. I still see error78
.
/var/log/system.log
has this errors:
14:46:00 Macchiato com.apple.xpc.launchd[1] (com.test.test[519]): Service could not initialize: 18A391: xpcproxy + 11291 [1534][8188841E-6D08-3F80-8488-9B5D7462BACB]: 0xd
14:46:00 Macchiato com.apple.xpc.launchd[1] (com.test.test[519]): Service exited with abnormal code: 78
14:46:00 Macchiato com.apple.xpc.launchd[1] (com.test.test): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
The plist
file itself is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.test.test</string>
<key>ProgramArguments</key>
<array>
<string>/Users/test-user/test/test</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ProcessType</key>
<string>Standard</string>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/var/log/test-err.log</string>
<key>StandardOutPath</key>
<string>/var/log/test-out.log</string>
</dict>
</plist>
Error logs are empty.
When I run the binary manually, the icon of the app appears on the system tray, as expected.
There's one interesting moment – if I manually type launchctl load -w com.test.test.plist
, app runs nicely – until the reboot. After I reboot, launchctl
throws 78
error.
Why is this happening?