Sample
V2EX  ›  macOS

macOS Ventura 13.1 添加开机后台运行失败,不停弹通知

  •  
  •   Sample · Dec 24, 2022 · 2695 views
  •   You need to sign in to view this topic
    This topic created in 1427 days ago, the information mentioned may be changed or developed.

    系统

    macOS Ventura 13.1

    怎么添加的后台运行

    brew services start clash
    

    问题

    • 在系统「设置」中的「登录项」有出现
    • 但是 ps|grep clash 并没有发现 clash 启动,而且会弹出很多同样的通知,而且是不停的弹出,如下图

    之前做过什么

    进入过 Recovery 模式,并且执行过命令:

    csrutil disable
    

    后来又csrutil enable了

    我已经重装系统了,但是还是有这个问题

    9 replies  •  2023-01-03 12:11:59 +08:00
    Williamongh
    Williamongh
    Dec 24, 2022
    1
    删除启动项
    Sample
    Sample
    OP
    Dec 24, 2022
    2
    @Williamongh 但我想开机运行 clash 啊
    derek80
    derek80
    Dec 24, 2022 via iPhone
    3
    @Sample 开机启动里添加应用啊
    Sample
    Sample
    OP
    Dec 25, 2022
    4
    @derek80 「系统设置」中的开机启动只能添加 `/Applications` 下的应用,如何把 `/usr/local/bin` 下的命令行应用加入开机?
    weeei
    weeei
    Dec 26, 2022
    5
    @Sample 做成后台服务:


    <?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.github.Dreamacro.clash</string>
    <key>Program</key>
    <string>/bin/sh</string>
    <key>ProgramArguments</key>
    <array>
    <string>/bin/sh</string>
    <string>/usr/libexec/clash-wrapper</string>
    </array>
    <key>ProcessType</key>
    <string>Background</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    </dict>
    </plist>
    weeei
    weeei
    Dec 26, 2022
    6
    clash-wrapper 的内容:

    #!/usr/bin/env sh

    set -e

    /usr/bin/clash -d /usr/etc/clash
    weeei
    weeei
    Dec 26, 2022
    7
    加载服务:

    launchctl load -w /Library/LaunchDaemons/com.github.Dreamacro.clash.plist
    Sample
    Sample
    OP
    Dec 26, 2022
    8
    @weeei 这些我知道,无论是系统级别的还是 ~/Library/Launch...下都出现我上面那些问题,我最后写了 shell 脚本把要开机的一些命令行打包一起手动启动了,这个我估计是新系统的问题,如果你是最新的 macOS 不妨试试。

    最后,感谢你的回答,有心了。
    ihwbunny
    ihwbunny
    Jan 3, 2023
    9
    装个配置描述文件,参考: https://www.bilibili.com/video/BV15A411R71u
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2030 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 05:58 · PVG 13:58 · LAX 21:58 · JFK 00:58
    ♥ Do have faith in what you're doing.