Select Page


Ngrok is an HTTP Tunneling software which allows you to expose a local server in your machine to the Internet. When you expose a program which is stored in your local machine by using ngrok, it takes your port number and hosts it under a subdomain of ngrok. What this means is that you won’t need to use your public IP address nor the domain name to share your resources to the web, which can impose severe security concerns. 

Ngrok has a command line tool which can be used from within a terminal to start, stop and monitor a tunnel. However, many users have encountered the following error message when trying to run ngrok:

$ ngrok: command not found

Which is why in this article, I’ll present to you the solution to fixing this error message, and get your tunnel up and running without a hitch!

Install ngrok in your system 

The one and only solution to fixing “ngrok: command not found” is to install ngrok on your machine. But there are three ways you could install it. The first option is to use a package manager. The only problem with this is that different Linux distributions as well as MacOS uses different package managers. Also, many system repositories don’t even have the ngrok package which you can directly install using their package manager. Your only resort in that case would be to either install ngrok from the pre-compiled binaries, or by building it from scratch using build tools.

Anyways, for now, as long as you have as you’re using any of the distributions mentioned below, you should be able to breathe peace as simply copy pasting the below commands should install ngrok for you. Many of you may be using some other distributions, which are actually based on one of the mentioned ones here. So for those cases, you can use the commands which are adjacent to the ones mentioned below:

Arch Linux

$ sudo pacman -Syu ngrok


$ sudo apt-get update
$ sudo apt-get install ngrok


$ sudo apt-get update
$ sudo apt-get install ngrok


$ sudo yum makecache
$ sudo yum install ngrok


$ sudo dnf makecache
$ sudo dnf install ngrok


$ sudo dnf makecache
$ sudo dnf install ngrok


$ brew install ngrok

In all the other distributions of Linux other than Arch, as well as in MacOS (which is not a Linux distribution, to be clear, but is a UNIX one so I’m including it for the sake many fellows using MacOS) the first line of command is required to update the distro’s repository, as otherwise you might be unable to install the packages properly. The second line of command will install ngrok on your machine.

If you’re using older versions of Debian and or Ubuntu, it’s possible that your repository does not have the ngrok package. In this case, you can try running the following shell script to see if it helps:

$ curl -s | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok

If this does not, however, you can also use snapcraft to install ngrok:

$ snap install ngrok

On the other hand, MacOS users can benefit from the pre-compiled binaries, available in the download page of ngrok’s official website. First visit the following link:

Here, under MacOS, first select your CPU architecture. If you’re using a system with the latest M1 Mac Chip, you’d select ARM64 in the drop-down menu. Or else, if you’re using a system with an Intel CPU, select the AMD64 one. Now click on the download button to get your hands on the zip file. 

Once the download is over, and navigate to the directory where the zip file got downloaded (it should automatically be extracted in newer versions of MacOS), and execute the binary file with your terminal emulator:

$ ./ngrok http 80

Install ngrok from source code 

Ngrok v2.x does not have any source code published for public use, so you unfortunately won’t be able to compile the latest versions of it yourself. However, if the features of v1.x are enough for you and you have no other way to use ngrok, you can use the source code hosted in the following github page:

However, you need to be very careful about not using this version for any production-level use, as the README suggests. 

To build this package from scratch, first extract the code from this repository using git clone:

$ git clone

After that, enter the folder that got pulled, and inside the folder run the following command:

$ make && sudo make install

You should now be able to run ngrok v1.x using your terminal. It’s best to avoid this version if you can, but if you really need it, go ahead!

Alternatives to ngrok

Ngrok is definitely a reliable tunneling service. I’m not gonna lie, as I’ve used it myself before. However, their price tag for the pro subscription is a nifty one for many. You can of course use it for free, but there are heavy downsides to it, the most painful of which is the absence of a custom sub-domain in the free version. This means that everytime you start the tunnel, you’d be given a new URL to be shared to the viewers. If you’re fine with it, very well indeed. If you’re not, I’m glad to say there actually are quite a few reliable alternatives you could try out:

  1. border0 (formerly known as mysocket)
  2. Localtunnel
  3. Telebit
  4. bore
  5. expose

All the alternatives mentioned above are free, while giving you all the features. No, I’m not lying. Border0 has been formerly known as mysocket, as I’ve been a loyal user. Currently, it has a premium subscription available, but the good thing about it is that the Community Edition is perfectly enough for personal use, as long as you’re not using it for a big team with big projects. However, don’t take the other ones mentioned to be anything less.