前提:电脑上已安装并正在运行 WezTerm
(Windows 安装:winget install wezterm,需 Win10 1803+)。
curl -fLo termphone-agent https://codeagent.gqyl777.com/download/termphone-agent-darwin-arm64
chmod +x termphone-agent
xattr -d com.apple.quarantine termphone-agent 2>/dev/null || true
./termphone-agent --hub https://codeagent.gqyl777.com --pair 配对码 \
--host 127.0.0.1 --port 7878 --token my-secret-token
curl -fLo termphone-agent https://codeagent.gqyl777.com/download/termphone-agent-darwin-amd64
chmod +x termphone-agent
./termphone-agent --hub https://codeagent.gqyl777.com --pair 配对码 \
--host 127.0.0.1 --port 7878 --token my-secret-token
curl.exe -o termphone-agent.exe https://codeagent.gqyl777.com/download/termphone-agent-windows-amd64.exe
Unblock-File .\termphone-agent.exe
.\termphone-agent.exe --hub https://codeagent.gqyl777.com --pair 配对码 --token my-secret-token
首次运行若弹 SmartScreen:右键 → 属性 → 解除锁定,或「仍要运行」。
配对码 替换进去)。成功后终端打印
[hub] 配对成功,App 设备页自动出现该电脑在线。macOS:新建 ~/Library/LaunchAgents/com.termphone.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.termphone.agent</string>
<key>ProgramArguments</key><array>
<string>/完整路径/termphone-agent</string>
<string>--hub</string><string>https://codeagent.gqyl777.com</string>
<string>--host</string><string>127.0.0.1</string>
<string>--port</string><string>7878</string>
<string>--token</string><string>my-secret-token</string>
</array>
<key>RunAtLoad</key><true/>
<key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
</dict></plist>
# 加载:launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.termphone.agent.plist
配对成功后凭证已保存在 ~/.config/termphone/device.json,自启命令不需要 --pair。
Windows(登录后静默运行):
schtasks /Create /TN TermPhone /TR "'%CD%\termphone-agent.exe' --hub https://codeagent.gqyl777.com --token my-secret-token" /SC ONLOGON /RL LIMITED
pgrep termphone / 任务管理器)。TermPhone · 我的设备