mac os x 启动完成后启动守护进程

mac os x start a daemon after boot completed

我正在使用这个 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.test</string>
    <key>ProgramArguments</key>
        <array>
            <string>/Users/hzorha/Downloads/trunk/build/g5/macos/src/bin/g5/test</string>
        </array>
    <key>RunAtLoad</key>
        <true/>
    <key>KeepAlive</key>
        <true/>
</dict>
</plist>

test 是二进制文件的名称。

我把它放在了 /Library/LaunchDaemons/com。test.plist

我哪里做错了,因为它没有在计算机启动时启动。

来自 launchctl loadunload 子命令的手册页:

Load the specified configuration files or directories of configuration
files.  Jobs that are not on-demand will be started as soon as possible. All
specified jobs will be loaded before any of them are allowed to start. Note
that per-user configuration files (LaunchAgents) must be owned by root (if
they are located in /Library/LaunchAgents) or the user loading them (if they
are located in $HOME/Library/LaunchAgents).  All system-wide daemons
(LaunchDaemons) must be owned by root. Configuration files must disallow
group and world writes. These restrictions are in place for security rea-
sons, as allowing writability to a launchd configuration file allows one to
specify which executable will be launched.

Note that allowing non-root write access to the
/System/Library/LaunchDaemons directory WILL render your system unbootable.