碳基体

奋斗在产品安全第一线的安全妹子

mac os x开机自动运行程序的方法(以自动运行goagent proxy.py为例)



第一步:打开终端运行如下命令

sudo vim /Library/LaunchDaemons/com.go.agent.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.go.agent</string>
        <key>ProgramArguments</key>
        <array>
        <string>python</string>
        <string>/Users/leedani/Downloads/goagent/local/proxy.py(修改为存放goagent proxy.py的路径)</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
</dict>
</plist>

launchctl load /Library/LaunchDaemons/com.go.agent.plist 


第二步:重启系统

来源:碳基体