Set up a machine for Lema
Install the prebuilt CLI and VM, prepare the checker and library pack, and confirm the selected runtime works.
Before installing
Use a supported Apple Silicon Mac or Linux x86_64 host. Installation uses a shell, HTTPS-capable curl, tar, gzip and a SHA-256 utility. These are separate from the TLS 1.3 curl needed to test the HTTPS starter.
On macOS with Homebrew, install the starter’s external tools if you choose the direct installer:
brew install openssl@3 curlThe Lema Homebrew formula installs these dependencies itself. Lema discovers supported tools in PATH and Homebrew’s opt directories, so no OpenSSL or curl PATH override is needed. It tests OpenSSL’s Ed25519 support before creating a certificate and prints the selected curl command when the app starts.
On the supported Debian baseline, install the OS packages:
sudo apt install bubblewrap openssl curlBubblewrap must be the root-owned /usr/bin/bwrap, with no group or other write permission. A Homebrew copy does not meet that requirement. The systemd workstation profile also needs a working user manager and delegated cgroup controllers; Requirements explains the host controls.
Ubuntu uses the same package names, but its AppArmor user-namespace restrictions need a suitable policy for Bubblewrap. The tested Ubuntu host already had that policy; an ordinary package install alone is not the qualified setup. Check the Ubuntu requirement before continuing there.
1. Install the CLI and VM
The direct installer checks archive sizes and SHA-256 digests before activating the matching pair:
curl --proto '=https' --tlsv1.2 -fsSLo install-lema.sh https://www.lema-lang.org/install.sh
sh install-lema.shRead the downloaded script first if you want to inspect its steps. It installs under $XDG_DATA_HOME/lema, or $HOME/.local/share/lema when XDG_DATA_HOME is unset. Run the PATH command it prints. Add that same command to your shell configuration if you want Lema available in future terminals; the installer leaves that file for you to edit.
To choose another location, pass a quoted absolute path:
sh install-lema.sh --dir "$HOME/Lema tools"Spaces and non-ASCII text are supported. The destination must have real directory ancestors owned by you or root, with no group or other write permission. Unsafe paths are refused without changing their permissions. If another Lema is already on PATH, use that package manager or choose an explicit separate destination; type -a lema shows the shell’s choices.
Alternatively, use Homebrew. On Linux, its x86_64 support requires SSSE3; see Homebrew’s host requirements. This additional prerequisite applies to the Homebrew route:
brew tap lorenalabs/lema https://brew.lema-lang.org/homebrew-lema.git
if brew help trust >/dev/null 2>&1; then
brew trust --formula lorenalabs/lema/lema
fi
brew install lorenalabs/lema/lemaThe trust step approves only Lema’s formula and is skipped when Homebrew has no trust command.
Both methods install prebuilt lema and lema-vm-runner together. Neither compiles Lema or needs Rust, GitHub authentication, or the language repository. The binaries are free to use under Lema’s binary license, including in commercial projects; the license specifies the terms for redistributing the VM and required library objects.
Check what your terminal will run:
lema --version
lema build-info --check-workerThe second command reports the release/build identity and checks that the selected VM matches this CLI. Keep the pair together when moving an installation. Release downloads and checksums are available for manual installation.
2. Complete setup
lema setupFor a fresh configuration, setup downloads the pinned Lean 4.34.1 distribution, checks its archive and extracted files, and prepares the runtime under $LEMA_HOME (normally ~/.lema). It creates the configuration, evidence directory and native-call lock with protected permissions.
Lema’s binaries and library packs come from its Cloudflare download service. Lean’s archive uses Lean’s official public upstream downloads, currently hosted on GitHub; no GitHub account is required.
Setup then checks the exact configuration later commands select. Selection is an explicit --runtime CONFIG, then LEMA_RUNTIME, then $LEMA_HOME/runtime.json. Existing configurations are kept byte for byte. A selected file must exist; setup does not create a different configuration to make its check pass.
After the sandboxed runtime check, setup installs the matching platform’s standard-library pack. The pack supplies modules labelled checked (Lema release). Your own code is always checked locally. lema new and lema lib add use the installed pack without downloading it themselves.
The successful finish line is:
setup complete; selected runtime: /your/actual/path/runtime.jsonPaths and earlier progress lines vary. The command must exit successfully; runtime: ready followed by library pack: NOT ready is an incomplete setup. KVM availability is reported separately and is not required for the VM or the HTTPS starter.
If setup stops
| Diagnostic | Next step |
|---|---|
| A download failed or was interrupted | Fix connectivity and run lema setup again. Completed valid downloads are reused; incomplete files are not selected. |
library pack: NOT ready | Retry the download, or supply the matching archive with lema setup --pack-archive "/path/to/pack.tar.zst". |
runtime ...: NOT ready | Check the exact configuration path printed. Correct that file or choose an existing authoring runtime with --runtime CONFIG; setup preserves the file. |
| Another setup holds the lock | Let it finish, then retry. Do not remove a lock while its process is using it. |
| A native call is busy or resources are low | Wait for the active check or free the resource named in the diagnostic. Temporary refusals use exit code 75. |
| A path or ownership check fails | Choose a protected directory you own and retain the required permissions. Keep the required sandbox and ownership checks. |
For deliberate local library checking, lema setup --no-pack skips the release pack and prints that libraries will be checked locally. This is slower and is not the first-run path above. A changed store axiom policy can also require local checking. lema verify --libraries requests local replay; its current single-call limit supports small closures, not the echo starter’s full HTTPS library.
To repeat the sandbox check after changing a host or configuration, use lema check-runtime. Its success reports that a native check ran under the selected profile. See runtime configuration for custom layouts and manual Lean installation for staged toolchain archives.
3. Create a project
Continue with Get started with Lema for the HTTPS app. For a smaller command-line project:
mkdir -p "$HOME/lema-projects"
cd "$HOME/lema-projects"
lema new hello
cd hello
lema statusThe project has its own .lema/store and background codebase server. lema status reports it, lema stop stops it after active work drains, and lema start starts it again. Commands find the project from lema.json in the current directory or a parent. Long project paths use an automatic short socket path; spaces and non-ASCII names do not need a special workflow.
You can give a coding agent the same project commands. Ask it to preserve contracts, run lema add after edits, and test with an explicit --expect oracle. Work with a Lema project covers the authoring loop. Builder-only requirements belong in Build the Lema tools from source.
Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility