ngrok is a cool service for creating public URLs of the local sites. This service comes handy when we want to share our local work to remote customers. Sometimes the developer needs this for the testing local site in different devices. Following are the steps to install ngrok in Mac:
Try using brew command
$ brew install ngrok
We may run in the following error when we run the above command:
Error: No available formula with the name “ngrok”
If the brew does not have ngrok available then try the brew graphical extension brew cask.
$ brew cask install ngrok
This should successfully install the ngrok.
How to start http with ngrok
Let say we an app running on port 8080 locally and we want create a public URL for our local app. We can simply run the following command:
$ ngrok http 8080
If it connects properly it will show the following status on the console:
Session Status online Session Expires 7 hours, 57 minutes Version 2.3.34 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding http://5487fe12.ngrok.io -> http://localhost:8080 Forwarding https://5487fe12.ngrok.io -> http://localhost:8080