Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing ngrok on Mac

Installing ngrok on OSX

brew cask install 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)

@milocosmopolitan

This comment has been minimized.

Copy link

commented Aug 19, 2016

While downloading the zip file from ngrok website and installing was not successful, this command line worked for me.
$ brew cask install ngrok

@thesunwave

This comment has been minimized.

Copy link

commented Feb 13, 2017

@milocosmopolitan as far i know, cask have an old version 1.x, but latest 2.x

@Omavibot

This comment has been minimized.

Copy link

commented Mar 3, 2017

@milocosmopolitan from then on which directory did you have to use to execute ngrok commands?

@jayaram171992

This comment has been minimized.

Copy link

commented Mar 14, 2017

http://ngrok.com was unreachable for me. So I did npm install -g ngrok and it works too

@pbrooker

This comment has been minimized.

Copy link

commented May 14, 2017

jayaram1711992 offers a correct option. Works quite smoothly.

@mitchellporter

This comment has been minimized.

Copy link

commented May 26, 2017

Works perfectly thanks @wosephjeber

@shamoman

This comment has been minimized.

Copy link

commented Jun 21, 2017

i want change the default port 80 to 8080, but i do not know how to change it, any one can help me?

@ronanmccoy

This comment has been minimized.

Copy link

commented Jun 29, 2017

@shamoman, if I understand your question correctly, ngrok allows you to change the port when you execute:

ngrok http -hostname=dev.example.com 8080 or ngrok http 8080

Does that not suffice?

If not you can try using a configuration file, see the docs here: https://ngrok.com/docs#config

@randall-vx

This comment has been minimized.

Copy link

commented Jul 27, 2017

@wosephjeber nice gist ! Works fine for me !

@nickcobbett

This comment has been minimized.

Copy link

commented Aug 11, 2017

Thank you!

@floracitrus

This comment has been minimized.

Copy link

commented Sep 21, 2017

Thank you @jayaram171992 that works for me

@nicooprat

This comment has been minimized.

Copy link

commented Oct 11, 2017

npm i -g ngrok 👍

@roblav96

This comment has been minimized.

Copy link

commented Feb 2, 2018

@nicooprat you are winning!

@artur79

This comment has been minimized.

Copy link

commented Feb 22, 2018

@thesunwave cask has 2.2.8 currently

@EstebanMarin

This comment has been minimized.

Copy link

commented May 24, 2018

yes npm i -g ngrok much better. That way is accessed globally

@toddpla

This comment has been minimized.

Copy link

commented Oct 15, 2018

While downloading the zip file from ngrok website and installing was not successful, this command line worked for me.
$ brew cask install ngrok

Worked for me. Thanks

@joeyfigaro

This comment has been minimized.

Copy link

commented Nov 12, 2018

Error: Cask 'ngrok' does not have a sha256 checksum defined and was not installed.

^ For those using require-sha for homebrew

@dlaweb

This comment has been minimized.

Copy link

commented Nov 26, 2018

Has anyone ever encountered this problem ? :
The error encountered was: dial tcp [::1]:8080: getsockopt: connection refused

@JacobMGEvans

This comment has been minimized.

Copy link

commented Nov 26, 2018

brew cask install ngrok gave me the 2.x version and was much easier than their suggested means of installation.

@gregorypierce

This comment has been minimized.

Copy link

commented Jan 26, 2019

Echo that brew cast install ngrok worked just fine and made it globally available.

@vkuzmitskaya

This comment has been minimized.

Copy link

commented Feb 1, 2019

only brew cask install ngrok really helped

@itsMagondu

This comment has been minimized.

Copy link

commented Feb 11, 2019

brew cast install ngrok

Should be brew cask install ngrok

@Kcin1993

This comment has been minimized.

Copy link

commented Feb 26, 2019

Yes. Just use brew cask install ngrok. Works fine!

@Biboswan

This comment has been minimized.

Copy link

commented Mar 22, 2019

helped me as well. brew always!

@jabelk

This comment has been minimized.

Copy link

commented Mar 31, 2019

helpful, thanks for writing!

@andrewoodleyjr

This comment has been minimized.

Copy link

commented Apr 16, 2019

+1 brew cask install ngrok

@ludiw823

This comment has been minimized.

Copy link

commented Apr 22, 2019

+1 brew cask install ngrok works!

@votanlean

This comment has been minimized.

Copy link

commented Apr 25, 2019

brew cask install ngrok works properly! +1

@david90278

This comment has been minimized.

Copy link

commented May 3, 2019

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

@IlkhamGaysin

This comment has been minimized.

Copy link

commented May 8, 2019

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

@MichaelSchmidt82

This comment has been minimized.

Copy link

commented May 15, 2019

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

@mahendrapk

This comment has been minimized.

Copy link

commented May 24, 2019

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

@Zwimber

This comment has been minimized.

Copy link

commented Jul 2, 2019

Worked like a charm (brew cask install ngrok )

@robo360

This comment has been minimized.

Copy link

commented Jul 16, 2019

Worked like a charm (brew cask install ngrok )

Does it also make it globally available?

@Zwimber

This comment has been minimized.

Copy link

commented Jul 16, 2019

Worked like a charm (brew cask install ngrok )

Does it also make it globally available?

Yes

@cyaconi

This comment has been minimized.

Copy link

commented Sep 26, 2019

brew cask install ngrok is the way! thanks

@wosephjeber

This comment has been minimized.

Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.