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

milocosmopolitan 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

thesunwave 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

Omavibot 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

jayaram171992 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

pbrooker commented May 14, 2017

jayaram1711992 offers a correct option. Works quite smoothly.

@mitchellporter

This comment has been minimized.

Copy link

mitchellporter commented May 26, 2017

Works perfectly thanks @wosephjeber

@shamoman

This comment has been minimized.

Copy link

shamoman 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

ronanmccoy 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

randall-vx commented Jul 27, 2017

@wosephjeber nice gist ! Works fine for me !

@nickcobbett

This comment has been minimized.

Copy link

nickcobbett commented Aug 11, 2017

Thank you!

@floracitrus

This comment has been minimized.

Copy link

floracitrus commented Sep 21, 2017

Thank you @jayaram171992 that works for me

@nicooprat

This comment has been minimized.

Copy link

nicooprat commented Oct 11, 2017

npm i -g ngrok 👍

@roblav96

This comment has been minimized.

Copy link

roblav96 commented Feb 2, 2018

@nicooprat you are winning!

@artur79

This comment has been minimized.

Copy link

artur79 commented Feb 22, 2018

@thesunwave cask has 2.2.8 currently

@EstebanMarin

This comment has been minimized.

Copy link

EstebanMarin commented May 24, 2018

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

@toddpla

This comment has been minimized.

Copy link

toddpla 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

joeyfigaro 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

dlaweb 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

JacobMGEvans 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

gregorypierce 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

vkuzmitskaya commented Feb 1, 2019

only brew cask install ngrok really helped

@itsMagondu

This comment has been minimized.

Copy link

itsMagondu commented Feb 11, 2019

brew cast install ngrok

Should be brew cask install ngrok

@Kcin1993

This comment has been minimized.

Copy link

Kcin1993 commented Feb 26, 2019

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

@Biboswan

This comment has been minimized.

Copy link

Biboswan commented Mar 22, 2019

helped me as well. brew always!

@jabelk

This comment has been minimized.

Copy link

jabelk commented Mar 31, 2019

helpful, thanks for writing!

@andrewoodleyjr

This comment has been minimized.

Copy link

andrewoodleyjr commented Apr 16, 2019

+1 brew cask install ngrok

@ludiw823

This comment has been minimized.

Copy link

ludiw823 commented Apr 22, 2019

+1 brew cask install ngrok works!

@vtla

This comment has been minimized.

Copy link

vtla commented Apr 25, 2019

brew cask install ngrok works properly! +1

@david90278

This comment has been minimized.

Copy link

david90278 commented May 3, 2019

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

@IlkhamGaysin

This comment has been minimized.

Copy link

IlkhamGaysin commented May 8, 2019

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

@MichaelSchmidt82

This comment has been minimized.

Copy link

MichaelSchmidt82 commented May 15, 2019

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

@mahendrapk

This comment has been minimized.

Copy link

mahendrapk commented May 24, 2019

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

@Zwimber

This comment has been minimized.

Copy link

Zwimber commented Jul 2, 2019

Worked like a charm (brew cask install ngrok )

@robo360

This comment has been minimized.

Copy link

robo360 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

Zwimber 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

cyaconi commented Sep 26, 2019

brew cask install ngrok is the way! thanks

@wosephjeber

This comment has been minimized.

Copy link
Owner 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.

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.