Loading Localhost from Mac to iPhone and Android

Testing your local environment against Xcode and Browserstack is great but at the end of the day they are still just emulators. If you need to test against an actual mobile device it is useful to load your current local environment on a mobile device and do your testing immediately before you push to a remote server.

The following instructions are pretty specific since most Front End dev where I work is done on a Mac but I imagine that the instructions would be similar for a Windows machine.

For the record there are third party plugins that you can do this with as well, but if you do not already have those installed as part of your workflow that should not stop you.

Mac to iPhone:

  1. Verify that your server is running locally, for example, http://localhost:3000
  2. Connect to the same network on both devices.
  3. Find your computers name by either looking in your sharing settings or opening up your terminal. Ex: acarlson-mac
  4. In a browser app on your phone go to {{your-computer-name}}.local:{{port}}

Mac to Android:

  1. Verify that your server is running locally, for example, http://localhost:3000
  2. Connect to the same network on both devices.
  3. Find your computers internal IP address by either looking in your sharing settings or using ifconfig in your terminal.
  4. In a browser app on your phone go to {{your-internal-ip}}:{{port}}

Leave a Reply

Your email address will not be published.