Macos mac os x在引导完成后启动守护程序

Macos mac os x在引导完成后启动守护程序,macos,Macos,我正在使用这个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> <

我正在使用这个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>

标签
com.test
程序参数
/Users/hzorha/Downloads/trunk/build/g5/macos/src/bin/g5/test
运行负荷
持久连接
test是二进制文件的名称

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


我做错了什么,因为它在计算机启动时不会启动。

加载
卸载
子命令的
启动CTL
手册页:

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.

它是否属于
root
所有,并且只有所有者
写入权限?另外,您在
sudo launchctl load/Library/LaunchDaemons/com.test.plist中有任何问题吗?我还注意到您正在将要启动的项目存储在您的home目录中。。。我不确定这是否有效,我从未尝试过-您可能需要使用用户级LaunchAgent,或者尝试将您的代码库移动到全局的某个位置。是的,这就是问题所在,plist不是root所有的,而是我的用户所有的。thx.如果你愿意,你可以把它作为答案贴出来,这样我就可以接受了