mac 配置goagent开机自动启动

1. 新建一个文件名为“~/Library/LaunchAgents/com.gae.goagent.plist”的文件
以vi为例
vi ~/Library/LaunchAgents/com.gae.goagent.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>RunAtLoad</key>  
        <true/>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>com.gae.goagent</string>
        <key>NetworkState</key>
        <true/>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/bin/python</string>
            <!--以下改为你GoAgent的proxy.py的路径,建议放到自己用户的路径下,这样不会有需要sudo的问题 -->
            <string>/Users/lkw/Documents/app/goagent/local/proxy.py</string>
        </array>
        <key>ServiceDescription</key>
        <string>GoAgent Local Service</string>
    </dict>
</plist>

保存退出
2.配置开机启动
launchctl load -w ~/Library/LaunchAgents/com.gae.goagent.plist
如果取消开机启动可运行
launchctl unload -w ~/Library/LaunchAgents/com.gae.goagent.plist

Comments are closed.