Last active
June 17, 2023 02:46
-
-
Save wpyoga/f30fb8fc3304d043ba508891a533e2e0 to your computer and use it in GitHub Desktop.
add iphone to vm and debug over wifi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macos ventura 13.4 on hackintosh vm | |
ios 16.4 on iphone x | |
on vm host | |
make udev rule file /etc/udev/rules.d/39-usbmuxd.rules: | |
# filename is chosen to overwrite /usr/lib/udev/rules.d/39-usbmuxd.rules | |
# see RULES FILES section in udev(7) | |
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*|5ac/8600/*", MODE="0666", TAG+="systemd" | |
this disables usbmuxd, otherwise it will run and communicate with the phone | |
once usbmuxd has captured the usb interface of the phone, when it is forwarded to the vm, | |
it won't appear in the xcode device list | |
deeper explanation: https://jon-gabilondo-angulo-7635.medium.com/understanding-usbmux-and-the-ios-lockdown-service-7f2a1dfd07ae | |
https://www.theiphonewiki.com/wiki/Usbmux | |
not sure which one copied which one | |
connect the iphone to the usb port | |
attach device to vm: | |
device_add usb-host,id=iphone,vendorid=0x05ac,productid=0x12a8 | |
don't use guest-reset=false because it will interfere with xcode resetting the iphone, so you need to unplug and replug after trusting | |
unlock iphone, Trust This Computer? Trust, enter device passcode when prompted | |
go into Settings -> Privacy & Security -> Developer mode, enable, then restart when prompted | |
after the phone has restarted, unlock the phone, Turn On developer mode when prompted | |
enable wireless debugging | |
$ xcrun xcdevice list | |
find the device's UDID, then | |
$ xcrun xcdevice enable <UDID> | |
or select Enable network connection on xcode devices window | |
do not disable, otherwise you will have to connect the iphone via usb again | |
open xcode | |
window -> devices and simulators (or cmd+shift+2) | |
device will appear, this is hot-plug ready | |
it will say "iPhone is busy: Making iPhone ready for development" | |
it is fetching debug symbols for your iphone | |
you can check the status with `xcrun xcdevice list` | |
wait until the message disappears, then close xcode | |
click on the bottom left + | |
choose the iPhone | |
click Next | |
use existing email or use a new one if desired | |
Device setup successful -> click Done | |
right click on the device on the left pane | |
click on Connect via IP Address... | |
input the tailscale hostname of the iphone | |
click Connect | |
https://stackoverflow.com/a/46721793 | |
try doing a screenshot, it should be successful | |
run a sample or tutorial app | |
keep xcode open, and keep xcode device window open | |
device_del iphone | |
$ xcrun xcdevice list | |
vscode on laptop, install extensions: | |
- swift | |
- ios debug | |
- remote ssh | |
in vscode, open console | |
$ security unlock-keychain login.keychain | |
then run debug build | |
https://code.visualstudio.com/docs/editor/debugging#_launch-configurations | |
https://code.visualstudio.com/docs/editor/tasks | |
https://www.alwaysrightinstitute.com/tows-ios/ | |
https://marketplace.visualstudio.com/items?itemName=nisargjhaveri.ios-debug | |
https://medium.com/swlh/ios-development-on-vscode-27be37293fe1 | |
alternative: https://github.com/sickcodes/Docker-OSX#usbfluxd-iphone-usb---network-style-passthrough-osx-kvm-docker-osx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment