An easy way to connect your Rails server to your phone

Last updated on December 20, 2021

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/

Invite us to your inbox.

Articles, guides and interviews about web development and career progression.

Max 1-2x times per month.