You need to enable JavaScript to run this app. Mac执行launchctl加载plist文件报No such file or directory错误求助
优惠活动
大模型
产品
解决方案
定价
更多

Mac执行launchctl加载plist文件报No such file or directory错误求助

问题排查点

  • 路径错误:你执行的launchctl load ~/Library/[username]/local.emailfriend.plist路径不符合macOS LaunchDaemons的默认存放规则。如果你存的是当前用户级的LaunchDaemons,正确路径是~/Library/LaunchDaemons/local.emailfriend.plist;如果是全局系统级的LaunchDaemons,路径是/Library/LaunchDaemons/local.emailfriend.plist,路径填写错误会直接触发「No such file or directory」报错。
  • plist语法错误:你提供的plist文件中StartCalendarInterval字段缺少对应的<dict>包裹,正确的配置应该是:
<?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>local.emailfriend</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/[myusername]/Documents/[executablefilename]</string>
        </array>
        <key>StartCalendarInterval</key>
        <dict>
            <key>Hour</key>
            <integer>23</integer>
            <key>Minute</key>
            <integer>59</integer>
            <key>Weekday</key>
            <integer>7</integer>
        </dict>
    </dict>
</plist>
  • 时间配置错误:你当前配置的Hour值为11,对应中午11点,和你预期的每周日23:59执行的需求不符,上述修正后的配置已将Hour的整数值改为23。
  • 权限校验:
    • 确认pyinstaller打包的可执行文件有执行权限,可执行chmod +x /Users/[myusername]/Documents/[executablefilename]添加权限
    • 如果你把plist放在/Library/LaunchDaemons目录下,加载时需要加sudo权限,执行sudo launchctl load /Library/LaunchDaemons/local.emailfriend.plist
    • 新版本macOS建议使用launchctl bootstrap代替旧的load命令,用户级服务执行launchctl bootstrap gui/$(id -u) ~/Library/LaunchDaemons/local.emailfriend.plist即可。

内容的提问来源于stack exchange,提问作者MSawers

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.09 04:09:00