Skip to content

Commit dca09ff

Browse files
Staacksclaude
andcommitted
iOS forward: invoke pymobiledevice3 as a module, fail early when absent
First MacBook-run finding, as the UNVERIFIED marker predicted: a pip-installed console script not being on PATH is the normal state on macOS, and because the forward runs as a background Popen, the bare FileNotFoundError only surfaced later as an unreachable port. The forward now runs as [sys.executable, -m, pymobiledevice3, ...] (verified working by the iOS session) and prepare() checks the module imports first, exiting with an actionable message instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent d9df37d commit dca09ff

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

tools/lab/device.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
import subprocess
14+
import sys
1415
import time
1516
import urllib.parse
1617
import urllib.request
@@ -122,11 +123,19 @@ def __init__(self, udid, port):
122123
def prepare(self, fixture_port=None):
123124
self.fixture_port = fixture_port
124125
# forward local port -> device port 80 (the app's server on
125-
# hardware). pymobiledevice3 is the portable choice; iproxy works
126-
# too. UNVERIFIED on hardware.
126+
# hardware). Invoked as a MODULE: a pip-installed console script
127+
# not being on PATH is the normal state on macOS, and a missing
128+
# binary in a background Popen would only surface later as an
129+
# unreachable port (found on the first MacBook run, 2026-08-26).
130+
try:
131+
import pymobiledevice3 # noqa: F401 - presence check only
132+
except ImportError:
133+
raise SystemExit(
134+
"pymobiledevice3 is not installed for this Python "
135+
f"({sys.executable}) - pip install pymobiledevice3")
127136
self._forward = subprocess.Popen(
128-
["pymobiledevice3", "usbmux", "forward", str(self.port), "80",
129-
"--serial", self.udid],
137+
[sys.executable, "-m", "pymobiledevice3", "usbmux", "forward",
138+
str(self.port), "80", "--serial", self.udid],
130139
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
131140
time.sleep(1)
132141

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
device: iphone-14-pro
2+
recorded: hand-finish this file into devices/iphone-14-pro.yml - see README
3+
experiments:
4+
accelerometer.phyphox: launch failed
5+
gyroscope.phyphox: launch failed
6+
magnetometer.phyphox: launch failed
7+
pressure.phyphox: launch failed
8+
light.phyphox: launch failed
9+
gps.phyphox: launch failed

tools/lab/lab.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
hosts:
77
macbook: # the default full set
8-
host_ip: 192.168.2.50 # how iOS devices reach this host's fixture server
8+
host_ip: 192.168.2.195 # how iOS devices reach this host's fixture server
99
aapt: aapt # or the full path into Android build-tools
1010
artifacts: # optional: enables the languages release check
1111
android: /home/dicon/phyphox/git/phyphox-android/app/regular/release/phyphox-release.apk
1212
ios: /path/to/phyphox.ipa
1313
devices:
14-
iphone-14-pro: {platform: ios, serial: "UDID-HERE", port: 8081}
14+
iphone-14-pro: {platform: ios, serial: "00008120-001C31520EC0C01E", port: 8081}
1515
iphone-8: {platform: ios, serial: "UDID-HERE", port: 8082}
1616
ipad-pro: {platform: ios, serial: "UDID-HERE", port: 8083}
1717
pixel-9-pro: {platform: android, serial: "53291FDAP0026B", port: 8091}

0 commit comments

Comments
 (0)