ngrok Installation and Public URL Checking Methods [macOS Edition]
I’ll introduce how to install ngrok, start it, and check public URLs.
 
Download from the official site ngrok - download, unzip, and run the ngrok file to start it.
On macOS, you can also install ngrok via Homebrew.
brew cask install ngrok
Check ngrok Version
To be sure, I checked the ngrok version and found that the official site and Homebrew versions were the same.
$ ngrok version
ngrok version 2.3.25
$ ~/Downloads/ngrok version
ngrok version 2.3.25
Expose a local web server to the internet | ngrok – documentation
ngrok http 8080
After starting ngrok with ngrok http 8080, you can check from the Forwarding section output to the Terminal.
$ ngrok http 8080
ngrok by @inconshreveable                                                                                                                                                                   (Ctrl+C to quit)
                                                                                                                                                                                                            
Session Status                online                                                                                                                                                                        
Session Expires               7 hours, 59 minutes                                                                                                                                                           
Version                       2.3.25                                                                                                                                                                        
Region                        United States (us)                                                                                                                                                            
Web Interface                 http://127.0.0.1:4040                                                                                                                                                         
Forwarding                    http://b0ef9220.ngrok.io -> http://localhost:8080                                                                                                                             
Forwarding                    https://b0ef9220.ngrok.io -> http://localhost:8080                                                                                                                            
                                                                                                                                                                                                            
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                                                   
                              0       0       0.00    0.00    0.00    0.00                                                                                                                                  Inspecting your traffic | ngrok – documentation
You can open URLs like these in your browser to check.
 
List Tunnels - Client API | ngrok – documentation
http://localhost:4040/api/tunnels returns a JSON response, and the public_url value corresponds to the public URL.
$ curl -s http://localhost:4040/api/tunnels | jq | grep public_url
      "public_url": "https://b0ef9220.ngrok.io",
      "public_url": "http://b0ef9220.ngrok.io",
Below are the curl output results and the results processed with jq command.
Output Result: curl http://localhost:4040/api/tunnels
$ curl -s http://localhost:4040/api/tunnels
{"tunnels":[{"name":"command_line (http)","uri":"/api/tunnels/command_line%20%28http%29","public_url":"http://b0ef9220.ngrok.io","proto":"http","config":{"addr":"http://localhost:8080","inspect":true},"metrics":{"conns":{"count":0,"gauge":0,"rate1":0,"rate5":0,"rate15":0,"p50":0,"p90":0,"p95":0,"p99":0},"http":{"count":0,"rate1":0,"rate5":0,"rate15":0,"p50":0,"p90":0,"p95":0,"p99":0}}},{"name":"command_line","uri":"/api/tunnels/command_line","public_url":"https://b0ef9220.ngrok.io","proto":"https","config":{"addr":"http://localhost:8080","inspect":true},"metrics":{"conns":{"count":0,"gauge":0,"rate1":0,"rate5":0,"rate15":0,"p50":0,"p90":0,"p95":0,"p99":0},"http":{"count":0,"rate1":0,"rate5":0,"rate15":0,"p50":0,"p90":0,"p95":0,"p99":0}}}],"uri":"/api/tunnels"}
Output Result: jq Processed Version
$ curl -s http://localhost:4040/api/tunnels | jq
{
  "tunnels": [
    {
      "name": "command_line",
      "uri": "/api/tunnels/command_line",
      "public_url": "https://b0ef9220.ngrok.io",
      "proto": "https",
      "config": {
        "addr": "http://localhost:8080",
        "inspect": true
      },
      "metrics": {
        "conns": {
          "count": 0,
          "gauge": 0,
          "rate1": 0,
          "rate5": 0,
          "rate15": 0,
          "p50": 0,
          "p90": 0,
          "p95": 0,
          "p99": 0
        },
        "http": {
          "count": 0,
          "rate1": 0,
          "rate5": 0,
          "rate15": 0,
          "p50": 0,
          "p90": 0,
          "p95": 0,
          "p99": 0
        }
      }
    },
    {
      "name": "command_line (http)",
      "uri": "/api/tunnels/command_line%20%28http%29",
      "public_url": "http://b0ef9220.ngrok.io",
      "proto": "http",
      "config": {
        "addr": "http://localhost:8080",
        "inspect": true
      },
      "metrics": {
        "conns": {
          "count": 0,
          "gauge": 0,
          "rate1": 0,
          "rate5": 0,
          "rate15": 0,
          "p50": 0,
          "p90": 0,
          "p95": 0,
          "p99": 0
        },
        "http": {
          "count": 0,
          "rate1": 0,
          "rate5": 0,
          "rate15": 0,
          "p50": 0,
          "p90": 0,
          "p95": 0,
          "p99": 0
        }
      }
    }
  ],
  "uri": "/api/tunnels"
}
That’s all from the Gemba on wanting to use ngrok to make Android and iOS app development more comfortable.