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)

@david90278
Copy link

david90278 commented May 3, 2019

brew cask install ngrok worked for me as well. +1

@IlkhamGaysin
Copy link

IlkhamGaysin commented May 8, 2019

brew cask install ngrok worked for me as well. +1

@MichaelSchmidt82
Copy link

MichaelSchmidt82 commented May 15, 2019

brew cask install ngrok worked for me as well++;

@mahendrapk
Copy link

mahendrapk commented May 24, 2019

brew cask install ngrok worked for me as well. +1

@Zwimber
Copy link

Zwimber commented Jul 2, 2019

Worked like a charm (brew cask install ngrok )

@robo360
Copy link

robo360 commented Jul 16, 2019

Worked like a charm (brew cask install ngrok )

Does it also make it globally available?

@Zwimber
Copy link

Zwimber commented Jul 16, 2019

Worked like a charm (brew cask install ngrok )

Does it also make it globally available?

Yes

@cyaconi
Copy link

cyaconi commented Sep 26, 2019

brew cask install ngrok is the way! thanks

@wosephjeber
Copy link
Author

wosephjeber commented Sep 27, 2019

Wow, can't believe this 4-year old gist has gotten so much traffic! Now that ngrok is available through Homebrew Cask, that's the simplest way to install it. I'll update the gist.

@romenigld
Copy link

romenigld commented Dec 15, 2019

$ brew cask install ngrok
so I'm using rails 6 I put:
$ ngrok http 3000
And put on the file config/enviroments/development.rb:
config.hosts << /.*\.ngrok\.io$/

@modermo
Copy link

modermo commented Jul 3, 2020

Works perfectly.

@jstgermain
Copy link

jstgermain commented Jul 16, 2020

you can just put ngrok in your root instead, and then just run
ngrok HTTP 80
mine is located at ~/ngrok

so do...

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

# create symlink
ln -s ~/ngrok ngrok

@idodekerobo
Copy link

idodekerobo commented Aug 29, 2020

worked great. still not the best w/ terminal commands so the symlink was v helpful. thanks

@dmitriyzyuzin
Copy link

dmitriyzyuzin commented Nov 18, 2020

It works, thanks!

@hiramhuang
Copy link

hiramhuang commented Dec 22, 2020

brew cask <command> was deprecated. Use this command to install instead:

brew install --cask ngrok

Homebrew/discussions#340 (comment)

@msudgh
Copy link

msudgh commented Jan 14, 2021

@andrewtheskills
Copy link

andrewtheskills commented Jan 19, 2021

@hiramhuang +1 Thanks!

@wosephjeber
Copy link
Author

wosephjeber commented Jan 19, 2021

Awesome, thanks for the heads up @hiramhuang! I've updated the gist accordingly.

@bibstha
Copy link

bibstha commented Jan 27, 2021

brew install ngrok automatically installs ngrok symlink now. But in macOS Big Sur, it will complain that it hasn't been signed and therefore you wont be able to run it.
To get this working, you have to

  1. In terminal: open /usr/local/Caskroom/ngrok/latest/
  2. right click ngrok and click open
  3. Click open again

After this, you can run ngrok as usual from command line.

@jjwang01
Copy link

jjwang01 commented Feb 1, 2021

@bibstha +1 thanks so much!

@alonsoCMrz
Copy link

alonsoCMrz commented Feb 5, 2021

brew install ngrok automatically installs ngrok symlink now. But in macOS Big Sur, it will complain that it hasn't been signed and therefore you wont be able to run it.
To get this working, you have to

  1. In terminal: open /usr/local/Caskroom/ngrok/latest/
  2. right click ngrok and click open
  3. Click open again

After this, you can run ngrok as usual from command line.

YEAAH that really helped

@roychowdhuryrohit-dev
Copy link

roychowdhuryrohit-dev commented Feb 11, 2021

@hiramhuang brew install ngrok installs an older (v2) of ngrok. How do I install the latest (v3) with brew?

@manishbassi
Copy link

manishbassi commented Feb 17, 2021

brew install ngrok automatically installs ngrok symlink now. But in macOS Big Sur, it will complain that it hasn't been signed and therefore you wont be able to run it.
To get this working, you have to

  1. In terminal: open /usr/local/Caskroom/ngrok/latest/
  2. right click ngrok and click open
  3. Click open again

After this, you can run ngrok as usual from command line.

This helped but now, it's saying command not found.
zsh: command not found: ngrok

Basically, it deletes ngrok file when I clicked it on 'open' at Step 3. Can you please help here?

@umarphaarook
Copy link

umarphaarook commented Mar 13, 2021

It worked, thanks

@juandefelix
Copy link

juandefelix commented Mar 24, 2021

Thank you!

@gitjul
Copy link

gitjul commented Jun 16, 2021

@bibstha thanks!

@Nuporly
Copy link

Nuporly commented Jun 20, 2021

┌──(kali㉿kali)-[/usr/local/bin]
└─$ ln -s ~/ngrok ngrok 1 ⨯
ln: failed to create symbolic link 'ngrok': Permission denied

@anhtuank7c
Copy link

anhtuank7c commented Oct 6, 2021

I just simple execute this command brew install ngrok

@fadlisaad
Copy link

fadlisaad commented Nov 10, 2021

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

greathiago commented Jan 5, 2022

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

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