Skip to content

Instantly share code, notes, and snippets.

@wosephjeber
Last active November 14, 2024 09:06
Show Gist options
  • Save wosephjeber/aa174fb851dfe87e644e to your computer and use it in GitHub Desktop.
Save wosephjeber/aa174fb851dfe87e644e to your computer and use it in GitHub Desktop.
Installing ngrok on Mac

Installing ngrok on OSX

For Homebrew v2.6.x and below:

brew cask install ngrok

For Homebrew v2.7.x and above:

brew install --cask ngrok

Using ngrok

The easiest way to use ngrok to tunnel into your localhost is if your local project is running on a specific port (e.g. not using named vhosts). You just run ngrok http [port number].

You can quickly boot up a local webserver using ruby. cd into the project's root directory and run ruby -run -e httpd . -p [port number].


If you don't want to use Homebrew...

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
cd /usr/local/bin

# create symlink
ln -s /Applications/ngrok ngrok

This will allow you to run the ngrok command from any directory while in the terminal. Without the symlink, you would need to either cd into the Applications directory (or wherever you installed the executable) or reference ngrok with its full path every time (e.g. /Applications/ngrok 5000)

@VitaliyR
Copy link

VitaliyR commented Oct 8, 2024

@russorat Latest mac os fails:

==> Downloading https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-darwin-arm64.zip
curl: (35) LibreSSL/3.3.6: error:1404B42E:SSL routines:ST_CONNECT:tlsv1 alert protocol version

Error: Download failed on Cask 'ngrok' with message: Download failed: https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-darwin-arm64.zip

@russorat
Copy link

russorat commented Oct 8, 2024

@VitaliyR thanks for posting. I couldn't repro this, so maybe it was just transient. Could you try again?

==> Downloading https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-stable-darw
######################################################################### 100.0%
==> Unlinking Binary '/opt/homebrew/bin/ngrok'
==> Linking Binary 'ngrok' to '/opt/homebrew/bin/ngrok'
==> Purging files for version 3.3.2 of Cask ngrok
🍺  ngrok was successfully upgraded!

@VitaliyR
Copy link

VitaliyR commented Oct 8, 2024

brew install ngrok
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################################################################################################################################################################################################### 100.0%
==> Caveats
To install shell completions, add this to your profile:
  if command -v ngrok &>/dev/null; then
    eval "$(ngrok completion)"
  fi

==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/88c47925c27708227907c551ed381c65f8aa6626/Casks/n/ngrok.rb
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-stable-darwin-arm64.zip
curl: (35) LibreSSL/3.3.6: error:1404B42E:SSL routines:ST_CONNECT:tlsv1 alert protocol version

Error: Download failed on Cask 'ngrok' with message: Download failed: https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-stable-darwin-arm64.zip
brew install ngrok/ngrok/ngrok
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/services).
No changes to formulae or casks.

==> Downloading https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-darwin-arm64.zip
curl: (35) LibreSSL/3.3.6: error:1404B42E:SSL routines:ST_CONNECT:tlsv1 alert protocol version

Error: Download failed on Cask 'ngrok' with message: Download failed: https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-darwin-arm64.zip

Still no luck, also it's arm while you have non-arm as far as I can tell from your logs.

Have you tried arm version?

@russorat
Copy link

russorat commented Oct 8, 2024

thanks! sorry my output was cut off, but i was also using the arm64 version. I see another report of this as well: ngrok/homebrew-ngrok#35

I tried curling the exact endpoint with no issues. I checked the cert attached to bin.equinox.io and is seems to be valid, so i'm not sure what's happening here. I will keep looking.

  ~ ❯ curl -O https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-darwin-arm64.zip              ✘ INT  25s  3.0.0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 8493k  100 8493k    0     0   148k      0  0:00:57  0:00:57 --:--:--  184k
  ~ ❯                                                                                                   57s  3.0.0
  ~ ❯                                                                                                         3.0.0
  ~ ❯                                                                                                         3.0.0
  ~ ❯ curl --insecure -vvI https://bin.equinox.io/a/dW4eR4uyHNy/ngrok-v3-3.16.1-darwin-arm64.zip 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'

* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 / x25519 / RSASSA-PSS
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: CN=bin.equinox.io
*  start date: Sep  6 23:46:44 2024 GMT
*  expire date: Dec  5 23:46:43 2024 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R10
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* using HTTP/1.x
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* Request completely sent off
* Connection #0 to host bin.equinox.io left intact

@russorat
Copy link

russorat commented Oct 8, 2024

what does something like this show for you?
openssl s_client -connect bin.equinox.io:443 </dev/null 2>/dev/null | openssl x509 -inform pem -text

@VitaliyR
Copy link

VitaliyR commented Oct 8, 2024

@russorat Could not find certificate from <stdin>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment