Skip to content

Install

This page tells how to install localspace and how to set up your machine for it. You do these tasks one time for each machine.

localspace runs on macOS and Linux, on amd64 and arm64 processors. These programs must be on your machine:

  • git, because each source of a workspace is a git branch or checkout.
  • Docker, for the services with a Dockerfile and for resources such as Postgres and Redis. OrbStack, Docker Desktop, colima or any docker CLI context works.

The proxy for public URLs runs in a container. The DNS server of localspace also runs in a container. Docker must run when you start a workspace with an exposed service.

The script below downloads the release for your system, makes sure that the checksum is correct, and installs lo in ~/.local/bin.

Terminal window
os=$(uname -s | tr A-Z a-z); arch=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')
base=https://github.com/sanlilab/localspace/releases/latest/download
curl -fsSL -O "$base/localspace_${os}_${arch}" -O "$base/checksums.txt"
shasum -a 256 --check --ignore-missing checksums.txt
mkdir -p ~/.local/bin && install -m 755 "localspace_${os}_${arch}" ~/.local/bin/localspace
ln -sf localspace ~/.local/bin/lo
  1. Run the script in a terminal.
  2. Make sure that ~/.local/bin is in your PATH.
  3. Run lo version. It prints the version of lo.

The file is named localspace, and lo is a link to it. The two names run the same program.

Public URLs such as https://storefront.shop-a.lo must work on your machine. For this, two settings are necessary. The names in the .lo domain must go to your machine. Your system must trust the certificates of the proxy. lo setup does the two tasks.

  1. Run lo setup.
  2. Enter your password at the sudo prompt. lo shows the commands that sudo runs before it runs them.

lo setup does these tasks:

  • It writes the resolver file of the domain, so that the names in the .lo domain go to the DNS server of localspace. The DNS server runs in a container.
  • It adds the local certificate authority of the proxy to the trust store of your system.

sudo prompts for your password one time for the two tasks. If your machine is set up, lo setup prints This machine is set up. and changes nothing.

If a browser continues to warn about certificates, restart the browser. Firefox has a separate trust store and does not use the trust store of your system.

To change the domain or the other proxy settings, see machine settings.

Run lo about --check to see the version of lo, the directories that it uses, and if a newer release is available:

Terminal window
lo about --check

The command sends a request to GitHub for the newest release. If a newer release is available, the output has a line that starts with update and gives the address of the release. Run the install script again to update lo.

lo completion <shell> prints a completion script for bash, zsh, fish or powershell. The script completes the names of commands and flags. It also completes the names of workspaces, services and templates.

To use completion in the current shell only, load the script:

Terminal window
source <(lo completion zsh)

To use completion in each new shell, write the script to the place where your shell reads completions. These commands are for zsh. Use lo completion <shell> --help for the other shells.

Terminal window
# macOS
lo completion zsh > $(brew --prefix)/share/zsh/site-functions/_lo
# Linux
lo completion zsh > "${fpath[1]}/_lo"

Start a new shell to load the script. If completion is not on in your zsh, add autoload -U compinit; compinit to ~/.zshrc.

Run lo doctor to make sure that the installation works:

Terminal window
lo doctor

The command runs the checks of each module. Each line starts with ok or shows the problem that the check found. The checks include these items:

  • git runs.
  • The machine settings file is valid.
  • Each template is valid.
  • The checkout of each recorded source is there.
  • The Docker daemon answers.

lo doctor exits with code 1 if one check fails.

Run your first workspace.