Loading Localhost from Mac on your iPhone or Android

Testing your local environment against Xcode and Browserstack is great, but they’re still just emulators. If you need to test against an actual mobile device it’s 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 work here is done on a Mac but I imagine 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 don’t already have those installed as part of your workflow that shouldn’t 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.