Skip to content

Instantly share code, notes, and snippets.

@gabrc52
Created June 7, 2022 03:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gabrc52/2960d9905b835bdf750fc54f983d0412 to your computer and use it in GitHub Desktop.
Save gabrc52/2960d9905b835bdf750fc54f983d0412 to your computer and use it in GitHub Desktop.
Forward iOS device from host to guest (OSX-KVM)
#!/bin/bash
# Debug
set -o xtrace
GUEST_IP=192.168.122.221
HOST_IP=192.168.122.1
# Wipe the current usbfluxd, usbmuxd, and socat:
sudo killall usbfluxd
sudo systemctl restart usbmuxd
sudo killall socat
# Start usbfluxd and required stuff on host
sudo avahi-daemon -D
sleep 1
sudo systemctl restart usbmuxd
sudo socat tcp-listen:5000,fork unix-connect:/var/run/usbmuxd &
sleep 1
sudo usbfluxd -n
sleep 1
# Start usbfluxd and required stuff on guest
ssh -t $GUEST_IP "sudo launchctl start usbmuxd"
sleep 1
ssh -t $GUEST_IP "sudo /usr/local/sbin/usbfluxd -r $HOST_IP:5000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment