我尝试按启动时间及时更新Homebrew。我的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>ms.liu.homebrew.update</string>
<key>UserName</key>
<string>LiuMS</string>
<key>ProcessType</key>
<string>Background</string>
<key>EnvironmentVariables</key>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/brew</string>
<string>update</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>20</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>StandardOutPath</key>
<string>/usr/local/logs/ms.liu.homebrew.update.out</string>
<key>StandardErrorPath</key>
<string>/usr/local/logs/ms.liu.homebrew.update.err</string>
</dict>
</plist>
它确实以某种方式起作用:我可以launchctl start ms.liu.homebrew.update
手动执行以更新我的Homebrew。但是,launchd不会定期执行此服务:stdout重定向到的文件的最后更改是在两天前。
我试图获取有关此服务的信息,但一无所获:
> launchctl print user/%MyPID%/ms.liu.homebrew.update``
Could not find service "ms.liu.homebrew.update" in domain for uid: %MyPID%
看来我尚未成功加载我的服务。怎么样?我用过,launchctl load
但似乎已弃用。手册页建议使用引导程序:
> launchctl bootstrap user/%MyPID% %Path-to-plist%
> %Path-to-plist%: Service cannot load in requested session
我该怎么办?如何正确使用launchctl bootstrap
和launchctl print
?
我正在配备Retina显示屏(2013)的MacBookPro上运行OS X Yosemite GM Candidate 1。