Skip to content

Control a real USB-connected iPhone from Linux (no Mac, no paid developer account) and expose it to AI agents as MCP tools

发布前检查:改写历史后的提交号、源码部署文档补漏

Derrors6ebde0d524d4
diff --git a/.gitleaksignore b/.gitleaksignore
index 150dfa8..6727d6f 100644
--- a/.gitleaksignore
+++ b/.gitleaksignore
@@ -1,5 +1,5 @@
# 上游 apple-codesign 自带的示例,不是真实密钥:
# docs/apple_codesign_github_actions.rst — 文档里演示 PEM 格式的样例
# tests/cmd/generate-self-signed-cert.trycmd — 测试期望输出,私钥内容是 [..] 占位
-de25cad2134600b81a6f0bbafff0cdd545e521a0:vendor/apple-codesign/docs/apple_codesign_github_actions.rst:private-key:33
-de25cad2134600b81a6f0bbafff0cdd545e521a0:vendor/apple-codesign/tests/cmd/generate-self-signed-cert.trycmd:private-key:102
+a8aa2852db51ec2867da8ebde8307610c0038634:vendor/apple-codesign/docs/apple_codesign_github_actions.rst:private-key:33
+a8aa2852db51ec2867da8ebde8307610c0038634:vendor/apple-codesign/tests/cmd/generate-self-signed-cert.trycmd:private-key:102
diff --git a/README.md b/README.md
index 42cb6c9..d2def61 100644
--- a/README.md
+++ b/README.md
@@ -111,7 +111,7 @@ loginctl enable-linger "$USER" # start at boot without loggin
| Unsigned WDA | shipped in the image | downloaded (sha256-checked) before the first signing |
| Configuration | `.env` | environment variables, e.g. the systemd `EnvironmentFile` |
-Run the daemon, the CLI and the MCP server as the same user. With a host `usbmuxd` installed, `sudo systemctl mask usbmuxd` before going back to the container, or the two will fight over the phone.
+Run the daemon, the CLI and the MCP server as the same user; for another user, point them at it with `--socket` and `--data-dir` (or `ICTL_SOCKET`, `ICTL_DATA_DIR`). Run as root, the defaults match the container and the daemon starts its own usbmuxd — set `ICTL_MANAGE_USBMUXD=0` if the host already runs the usbmuxd service. With a host `usbmuxd` installed, `sudo systemctl mask usbmuxd` before going back to the container, or the two will fight over the phone.
## Commands
diff --git a/docs/dev/spike-results.md b/docs/dev/spike-results.md
index 78ef785..fa4c352 100644
--- a/docs/dev/spike-results.md
+++ b/docs/dev/spike-results.md
@@ -60,7 +60,7 @@ WDA 就绪,耗时 2.1s
runner 已停止
```
-- 第一次运行(10:30)`/status` 每次 5 秒超时:WDA 收到 `Connection: close` 也不关连接,客户端读到 EOF 就会挂住。已改为收齐一个完整响应即停(提交 `a13f34b`),修复后一次通过。
+- 第一次运行(10:30)`/status` 每次 5 秒超时:WDA 收到 `Connection: close` 也不关连接,客户端读到 EOF 就会挂住。已改为收齐一个完整响应即停(提交 `53c5c82`),修复后一次通过。
- runner 停止后,手机上的 WDA 仍响应 `/status`(停止后半分钟内仍为 `ready: true`,约 80 秒后不可达),与回归用例 #12 一致:就绪判定不能只看 `/status`。
- **未覆盖**:手机重启后首次启动时「Enable UI Automation」超时的报错文字(回归用例 #8)。
diff --git a/website/deploy/source.md b/website/deploy/source.md
index 200f2fe..0d851d0 100644
--- a/website/deploy/source.md
+++ b/website/deploy/source.md
@@ -34,6 +34,8 @@ iphone-control setup # 另开一个终端运行安装向导
iphone-control mcp-config # 打印注册 MCP 的命令
```
+只有下面的 systemd 服务会读 `~/.config/iphone-control/env`。前台运行时先加载它:`set -a; . ~/.config/iphone-control/env; set +a`。
+
### 常驻:systemd 用户服务
服务文件在仓库的 `deploy/iphone-control.service`(二进制压缩包里也有):
@@ -41,7 +43,7 @@ iphone-control mcp-config # 打印注册 MCP 的命令
```bash
mkdir -p ~/.config/systemd/user ~/.config/iphone-control
cp deploy/iphone-control.service ~/.config/systemd/user/
-cp .env.example ~/.config/iphone-control/env # 按需改代理、通知
+cp .env.example ~/.config/iphone-control/env # 按需改代理、通知(二进制压缩包里叫 env.example)
systemctl --user daemon-reload && systemctl --user enable --now iphone-control
loginctl enable-linger "$USER" # 不登录也随开机启动
```
diff --git a/website/en/deploy/source.md b/website/en/deploy/source.md
index 67bde73..471d9ec 100644
--- a/website/en/deploy/source.md
+++ b/website/en/deploy/source.md
@@ -34,6 +34,8 @@ iphone-control setup # setup wizard, in a second terminal
iphone-control mcp-config # prints the MCP registration command
```
+Only the systemd service below reads `~/.config/iphone-control/env`. In the foreground, load it first: `set -a; . ~/.config/iphone-control/env; set +a`.
+
### Keep it running: systemd user service
The unit is `deploy/iphone-control.service` in the repository (also included in the binary archives):
@@ -41,7 +43,7 @@ The unit is `deploy/iphone-control.service` in the repository (also included in
```bash
mkdir -p ~/.config/systemd/user ~/.config/iphone-control
cp deploy/iphone-control.service ~/.config/systemd/user/
-cp .env.example ~/.config/iphone-control/env # proxy, notifications, …
+cp .env.example ~/.config/iphone-control/env # proxy, notifications, … (env.example in the binary archive)
systemctl --user daemon-reload && systemctl --user enable --now iphone-control
loginctl enable-linger "$USER" # start at boot without logging in
```