Use expo on physical iPhone without wifi or lan

Hi my router is broken, so I don’t have an option in wifi and can’t also use a Hotspot because the phone gets extremely hot and damaged its battery once during this process, in Android when you connect via USB it works perfectly and doesn’t need a router but on ios I couldn’t find a way to do so, any workarounds would be appreciated, thanks.

Hey @stevemoretz, Metro needs a local network to function so this won’t be possible unfortunately.

Cheers,
Adam

Thank so you much for the answer but why does it work for android then?

Android is able to make use of port forwarding via adb.

Thanks I always wondered how that works on Android.Look like I need a new router after all.

This is actually possible on macos, not tested on Linux or windows yet though.

I’m going to share more information if I get them working too.

@adamjnav

Hello adam I tested on mac and could connect iPhone and mac through a usb and get it working using the internet Sharing feature of mac os, my mac also wasn’t connected to internet but it worked.

Here’s the full explaination:

In short you just connect the iPhone, turn on internet sharing from preferences → sharing and that’s pretty much it, you get the ip using ifconfig and use :

export EXPO_DEVTOOLS_LISTEN_ADDRESS=ip
export REACT_NATIVE_PACKAGER_HOSTNAME=ip
expo start

I also asked if it was possible on linux and the guy who answered the first question mentioned :

Yes, it’s possible. On Linux you’ll for example need to install libimobiledevice to make it work.

So this is doable, just wanted to inform you to see if you think it’s a good idea to officially support this? This is the missing peace of expo cli.

2 questions @stevemoretz

  1. when running ifconfig, what am I looking for? And what format should the IP address be?
  2. if I export REACT_NATIVE_PACKAGER_HOSTNAME= with the new IP, what will happen to my original WiFi connection? Do I need to undo the IP address?