Show off your Localhost with LocalTunnel

How to use the LocalTunnel gem to access your localhost on a different network

Today I had a need access my localhost from a device that was intentionally not on the same network, which meant I finally had a use case for playing about with LocalTunnel.

LocalTunnel is something I had heard of before but never really played with because I had no cause to, essentially it is a Ruby Gem that allows you to connect to your localhost on a specific port from a randomly assigned public address.

You install it the same way you would any gem;

gem install localtunnel

And you call it like this;

localtunnel -k ~/.ssh/ 3000

Which gives it your public ssh key and tells it to bind to port 3000.

Once this is done LocalTunnel will spit out a URL which you can copy and paste to access your local machine from anywhere.

Security Concerns?

My first and primary worry about this is that I am putting a part of my local machine on the internet, that obviously isn't deadly but because it is bound to one particular port, so long as you maintain good security practice on the thing you are now sharing with the world then your dev box is no less secure than your server should be, but I wouldn't advise running LocalTunnel for longer than you need to, it certainly shouldn't be considered a permanent solution to anything.

Recent posts View all


Prolonging your laptop's battery

Some short and long term solutions to extending your laptop's battery life


Working when travelling by plane/train

Some tips and tricks for maximising working whilst travelling