1

I wrote the following plist:

<?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.jacksonbockus.dnd.sync</string>
        <key>UserName</key>
        <string>jacksonbockus</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/jacksonbockus/Documents/Dev/aws/s3-sync.sh</string>
        </array>
        <key>KeepAlive</key>
        <true/>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardOutPath</key>
        <string>/Users/jacksonbockus/Documents/Dev/aws/s3-out.txt</string>
        <key>StandardErrorPath</key>
        <string>/Users/jacksonbockus/Documents/Dev/aws/s3-err.txt</string>
    </dict>
</plist>

In order to execute this script:

#!/bin/zsh
/usr/local/bin/fswatch /Users/jacksonbockus/fvtt | (while read; do 
    /usr/sbin/dot_clean Users/jacksonbockus/fvtt;
    /usr/local/bin/aws s3 sync /Users/jacksonbockus/fvtt s3://jbockus-fvtt/ --delete --acl public-read;
done;)

I loaded it with this command:

launchctl load -w s3-sync.plist

And I am now getting this error:

Sep 17 10:58:50 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync[4919]): Service could not initialize: 20G95: xpcproxy + 23787 [839][12D7C9E4-2F89-3A76-A1C0-D310F417BC41]: 0x1
Sep 17 10:58:50 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync[4919]): Service exited with abnormal code: 78
Sep 17 10:58:50 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

I am running macOS 11.5.2. I don't know what error the 0x1 refers to, so I have no idea what to do to troubleshoot it. If anyone can help me figure out what's going wrong, I will be most appreciative.

EDIT: I have removed StandardOutPath and Standard ErrorPath and am getting new errors

Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync): This service is defined to be constantly running and is inherently inefficient.
Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.apple.xpc.launchd.user.domain.501.100006.Aqua): com.jacksonbockus.dnd.sync (lint): UserName is not supported for non-System services.
Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync[7069]): Service exited with abnormal code: 127
Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
GaiusOctavian
  • 108
  • 1
  • 6
  • Exciting updates. I removed StandardOutPath and StandardErrorPath and am now getting a new bunch of errors. – GaiusOctavian Sep 17 '21 at 19:17
  • Is this a LaunchAgent or LaunchDaemon? IE is it in `/Library/LaunchDaemons`, `/Library/LaunchAgents` or `~/Library/LaunchAgents`? – silicontrip May 21 '22 at 06:33

2 Answers2

0

I was stuck on this for a while too (I had the same error codes as you)

Firstly, you'll need to get rid of the <UserName> key in your plist (you can see the logs complain about this too). That's only required for LaunchDaemons.

Overall, what finally worked for me was to reboot my Mac in recovery mode and run csrutil disable; reboot after opening up a terminal instance from utilities. Of course, you'll also have to make sure your script is executable using chmod appropriately, and you might need to run chmod 644 on your .plist file (I am not sure if this is strictly necessary, just happened to be the case for me). Hope this helps!

Rohan G
  • 13
  • 3
0

I also had this error trying to deploy a Blazor Server app (as docker on Apple M1 seems still quite wacky and unreliable) and almost got crazy as it just wouldn't run as started from launchctl.

Simple solution was: launchctl doesn't like to start anything from a mounted volume. Deploying the app to local disk and starting it from there worked immediately.

Kerry
  • 101
  • 1
  • 7