Accessing your macbook’s localhost on your iPhone

Ishwar Rimal
2 min readMay 19, 2023

--

I know there are already 100s of articles on this, but searching for the right one is difficult, hence I am writing this for future myself to refer to. Feel free to take a reference.

I was traveling on a train, doing some development, and needed to access the Mac’s localhost from my iPhone to see the changes live.

Of course, I could deploy and see the change, but that would be data-inefficient.

I did some digging around and found a very easy solution to this.

Requirement:

  1. Interest* (else who works on train :O )
  2. MAC
  3. iPhone with internet connection.
  4. USB cable to connect your iPhone to your Mac.

Steps:

  1. Connect your iPhone to your Mac.
  2. Enable hotspot on your iPhone:
    You should be able to access the internet on your MAC now.
  3. Enable Internet Sharing :
    1. System settings -> search for sharing.
    2. Find internet sharing on the list and enable it.
  4. Find the IP address of Mac:
    1. System settings -> search for network.
    2. You should see the iPhone USB USB with connected status. Click on that.
    3. You’ll find the IP address there, copy that.

With this IP address, you can access your MAC’s localhost from your iPhone.

All you’ve got to do now is to find the port of your app and append it to the IP address.

For me: 172.20.0.7:5500

*I hope you read this as Interest and not Internet.

I hope you found this article useful. I would love to hear your thoughts. 😇

Thanks for reading. 😊

Cheers! 😃

If you find this article useful, you can show your appreciation by clicking on the clap button. As the saying goes, ‘When we give cheerfully and accept gratefully, everyone is blessed’.

--

--

Ishwar Rimal
Ishwar Rimal

Written by Ishwar Rimal

Senior FrontEnd Engineer at Intuit. 8 years experience. I write articles on JavaScript, React, Web Optimisation, Startups, Work Life Balance, etc. ❤️ JavaScrip

No responses yet