2025-04-15|mac 配置 easytier 以守护进程方式在后台运行
✅ 步骤一:创建 .plist
文件
我们可以将它创建为系统级守护进程(推荐存放在 /Library/LaunchDaemons/
,需要 sudo 权限),假设你的命令是:
sudo ./easytier-core -d --network-name hh8f9y478g29k2 --network-secret d46fg7yh968d5e7ug0823r -p udp://38.55.124.91:11010
📄 /Library/LaunchDaemons/com.easytier.core.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.easytier.core</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/easytier-core</string>
<string>-d</string>
<string>--network-name</string>
<string>hh8f9y4ffff78g29k2</string>
<string>--network-secret</string>
<string>d46fg7yh968d5ddfffse7ug0823r</string>
<string>-p</string>
<string>udp://38.55.xxx.xxx:11010</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/var/log/easytier.out</string>
<key>StandardErrorPath</key>
<string>/var/log/easytier.err</string>
</dict>
</plist>
🛠️ 步骤二:安装配置
-
将
easytier-core
移动到一个稳定路径(例如/usr/local/bin/
):sudo mv ./easytier-core /usr/local/bin/ sudo chmod +x /usr/local/bin/easytier-core
-
保存
.plist
文件:sudo nano /Library/LaunchDaemons/com.easytier.core.plist
然后粘贴上面的内容并保存。
-
设置权限(必须是 root 拥有者,权限 644):
sudo chown root:wheel /Library/LaunchDaemons/com.easytier.core.plist sudo chmod 644 /Library/LaunchDaemons/com.easytier.core.plist
-
加载服务:
sudo launchctl load /Library/LaunchDaemons/com.easytier.core.plist
-
(可选)重启后自动运行:
不用额外设置,只要
RunAtLoad
为true
就可以在开机自动运行。
✅ 检查运行状态
sudo launchctl list | grep com.easytier.core
查看日志:
sudo tail -f /var/log/easytier.out