An easy way to connect your Rails server to your phone

Published in December 2019

There are products such as ngrok which expose your localhost to the web, so you can access it on another machine, for example, another laptop or your phone. However, I often find that this method is an overkill for simple testing.

Get your IP address

Search for Network Utility and make a record of your IP address.

Another way to find your IP address is to click on the wifi icon in the menu bar with the option key pressed down. This will give you access to a bunch of information, including your IP address.

Start your server

Start your server using

rails server -b 0.0.0.0

This will allow you to access your Rails server from a different machine. You can read more about it here.

Access localhost on your phone

Using your IP address, access your Rails server on another machine using

http://your_ip:3000/

Level up your web development skills

Get articles, guides and interviews right in your inbox. Join a community of fellow developers.

No spam. Unsubscribe at any time.

Full Stack Heroes logo

© 2020 Full Stack Heroes