Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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)

@fadlisaad
Copy link

On macOS monterey, some command were broken. Please update brew using brew doctor and fix according to the suggested solution. Then install again using brew install ngrok

@greathiago
Copy link

Mac user here, the only that worked for me: sudo npm install --unsafe-perm -g ngrok

@AAdewunmi
Copy link

@wosephjeber ... Worked fine! Thanks 👍

Screenshot

@Limitless-Kode
Copy link

brew install --cask ngrok worked for me

@cjj1120
Copy link

cjj1120 commented Nov 11, 2022

For those that followed the second approach:

# create symlink
ln -s /Applications/ngrok ngrok

If u get permission denied, can try the same command with sudo in front.. worked for me.
and make sure this path (/Applications/ngrok ) is set to where your installed and unzip ngrok is located.

@russorat
Copy link

the correct instructions for installing via homebrew are: brew install ngrok/ngrok/ngrok from https://ngrok.com/download

the casks are out of date and should not be used.

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