localhost:

Run dev servers on a remote dev box and open them from your laptop

Run dev servers on a dev box or home server and open them from your laptop: ssh -L port forwarding, Tailscale and ~/.ssh/config, then one window for both.

The quickest way is one SSH connection that forwards the dev server’s port to your laptop, and the server started in it:

ssh -L 5173:localhost:5173 devbox
cd ~/code/acme-shop && pnpm dev

Now http://localhost:5173 on your laptop is the dev server on the dev box. Add one -L per port (-L 8000:localhost:8000 for the API), and run it inside tmux on the dev box so closing the laptop doesn’t stop it.

Why run dev servers on another computer?

A desktop under the desk, a home server or a cloud VM often has more cores and memory than a laptop, stays on, and keeps the fans quiet. Builds, databases and Docker run there; the laptop only runs the browser and the editor. With VS Code’s or Cursor’s SSH remote, the editor already works on the dev box, and only the dev servers are left.

How do I reach the dev box from anywhere?

Any network SSH reaches works. Tailscale is the easiest from outside the house: install it on both computers and sign in with the same account, and the dev box gets a name such as devbox.tail1234.ts.net that works from any network, without opening a port on the router. A LAN, a VPN or a jump host (ProxyJump) work the same way.

Then give it a short name in ~/.ssh/config on the laptop:

Host devbox
  HostName devbox.tail1234.ts.net
  User you
  IdentityFile ~/.ssh/id_ed25519

and a key, so SSH never asks for a password:

ssh-keygen -t ed25519      # if you don't have a key yet
ssh-copy-id devbox
ssh devbox true            # should ask nothing, and print nothing

If the key has a passphrase, ssh-add keeps it in the SSH agent. The first ssh devbox asks whether to trust the dev box’s host key: check it, and answer yes.

Where does ssh -L fall short?

  • One port per flag, decided in advance. A Service that moves to another port, or a new one, means a new connection.
  • It stops with the terminal. The forward lasts as long as that ssh; the dev server as long as its shell, unless tmux holds it.
  • You can’t see what runs. Which servers are up, which crashed and why, is in a tmux pane on another computer.
  • Starting them is still by hand. The order, the commands and the environment are in your head, or in a script on the dev box.

How does localhost run them from your laptop?

localhost is a free, open-source desktop app that remembers how each Project runs. A dev box you reach with ssh can be one of its Machines: its Projects show in the window on your laptop, below the laptop’s own, and you start and stop them there.

  1. Install localhost on both computers, and add your Projects on the dev box, in its app as on any computer (Quick start), or through a coding agent there with localhost mcp. Projects on the dev box are edited on the dev box; the app there doesn’t have to stay open.

  2. Check that the laptop’s ssh finds it. A command run over SSH doesn’t read your interactive profile, so with zsh, set PATH in ~/.zshenv, not ~/.zshrc:

    ssh devbox localhost --version
  3. On the laptop, open Settings → Machines → Add Machine…, pick devbox from the hosts of ~/.ssh/config, and click Add. localhost connects first; if it can’t, it says why and what to do next.

  4. The dev box’s Projects show in the sidebar under its name. Start All, Stop, Restart and logs work as for a Project on the laptop, and the state of each Service is there at a glance.

  5. Open in Browser forwards the Service’s Port to the same port on your laptop, through the same SSH connection, then opens it: http://localhost:5173 there is http://localhost:5173 here, so OAuth callbacks and cookies keep working.

The Services run on the dev box, with its shell, its files and its Secrets; no Secret value reaches the laptop. Nothing new listens on either computer’s network: Forwards are bound to the laptop’s loopback only. If the connection drops, localhost makes it again on its own, without starting or stopping anything. Services you started from the laptop stop when the connection ends, unless localhost is open on the dev box.

When something doesn’t connect, Machines lists every message localhost shows and what to do.

FAQ

How do I open a dev server running on another computer in my browser?

Forward its port over SSH: ssh -L 5173:localhost:5173 devbox, then open http://localhost:5173 on your laptop. The forward lasts as long as that ssh. In localhost, Open in Browser makes the same forward for you, on the same port number.

Do I need Tailscale?

No. localhost uses whatever ssh devbox uses: a LAN, a VPN, a jump host with ProxyJump, or Tailscale. Tailscale is the easy way to reach a computer at home from anywhere, without opening a port on the router.

Does localhost open a port on the dev box?

No. It runs localhost remote --stdio over your SSH connection, and Forwards ride on that connection, bound to your laptop’s loopback only. Nothing new listens on either computer’s network.

What happens to the dev servers when I close my laptop?

The Services you started from the laptop stop on the dev box once the connection ends, about 45 seconds after the laptop goes quiet, unless localhost is open on the dev box. When the laptop is back, localhost connects again on its own, without starting anything.

Why does it say localhost isn’t installed on the dev box when it is?

A command run over SSH gets a non-interactive shell, which doesn’t read ~/.zshrc. Put the folder holding localhost on the PATH in ~/.zshenv (zsh) instead, and check with ssh devbox localhost --version.

Edit this page on GitHub

Install localhost for macOS

Two quick steps, usually under a minute.

  1. Drag it to Applications

    Open localhost-0.4.0.dmg and drag localhost to Applications.

    Download localhost-0.4.0.dmg

    Or install it with Homebrew, which also puts the localhost command in your terminal:

    brew install --cask marcellosso/tap/localhost

    Or download it from Terminal, which macOS doesn’t block, so you can skip step 2:

    curl -fLO https://github.com/marcellosso/localhost/releases/download/v0.4.0/localhost-0.4.0.dmg && open localhost-0.4.0.dmg
  2. Open it the first time

    localhost isn’t notarized by Apple yet, so macOS blocks the first launch once:

    1. Click Done in the warning.
    2. Open System Settings › Privacy & Security and scroll to Security.
    3. Click Open Anyway, and confirm with your password or Touch ID.

    Or run this in Terminal, then open localhost:

    xattr -dr com.apple.quarantine /Applications/localhost.app

macOS 15 or later · Apple silicon or Intel

  1. Run the installer

    Open localhost_0.4.0_x64-setup.exe. It installs for your user only, no administrator rights needed.

    Download localhost_0.4.0_x64-setup.exe
  2. Get past SmartScreen

    The installer isn’t signed by a known publisher yet, so Windows says “Windows protected your PC”:

    1. Click More info.
    2. Check that the file is localhost_0.4.0_x64-setup.exe.
    3. Click Run anyway.

Windows 10 or 11 · x64 · WSL 2 for Projects in WSL

  1. Download your package

  2. Install it

    From the folder you downloaded it to:

    sudo apt install ./localhost-app_0.4.0_amd64.deb
    sudo dnf install ./localhost-app-0.4.0-1.x86_64.rpm
    chmod +x localhost-app_0.4.0_amd64.AppImage && ./localhost-app_0.4.0_amd64.AppImage

    Secrets need a Secret Service (GNOME Keyring, KWallet). On stock GNOME the tray icon needs the AppIndicator extension.

x86_64 · Ubuntu 22.04+ · Debian 12+ · Fedora

On another system?Install guide →