osx添加自启动配置

概览:

缘由

近期看到一个在osx下在菜单栏显示流量的小软件ITraffic-monitor,没找到启用自动启动的配置。所以自己写了个自启动配置,方便后续使用。

配置

ITraffic.plist

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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.foamzou.ITraffic</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/Applications/ITraffic.app/Contents/MacOS/ITraffic</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>

启用

最后将配置文件ITraffic.plist复制到~/Library/LaunchAgents/ITraffic.plist

1
2
# reference command
cp ITraffic.plist ~/Library/LaunchAgents/ITraffic.plist