Install the pinned Lean distribution
Install and verify the pinned Lean 4.34.1 toolchain automatically with lema toolchain install, from a pre-staged offline archive, or step by step with lema verify-distribution.
Lema v0.3 pins Lean 4.34.1 separately for Linux x86_64 and Apple Silicon macOS. It uses these distributions instead of a system-wide elan installation, checking the archive’s SHA-256 and the extracted files against the host’s committed manifest. Canonical objects keep their identities across hosts; the executable and module cache belong to the host where they were built.
Before you start
- Linux x86_64 or Apple Silicon macOS, with
lemabuilt from v0.3.0 and on yourPATH(Set up a machine for Lema). curlfor automatic downloads. The Linux manual extraction example below also usessha256sumandtarwithzstdsupport; the built-in installer needs neither.
1. Automatic installation (lema toolchain install)
For everyday development, use lema setup: it installs the toolchain, configures the runtime, installs the matching release library pack and probes the sandbox. To install or inspect only the toolchain and default runtime configuration, run:
lema toolchain installinstalled /home/you/.lema/toolchains/lean-4.34.1-linux-x86_64 (17738 files, 12 symlinks; manifest c82b7b44dd02…)
wrote /home/you/.lema/runtime.jsonThe output above is from Linux. On Apple Silicon, the installation directory is ~/.lema/toolchains/lean-4.34.1-darwin-aarch64 and a new configuration uses "profile": "macos". The Darwin manifest covers 17,711 regular files and no symlinks. The schema stays lema.runtime-linux/v2 on both hosts.
lema toolchain install reuses an existing installation that passes verification, without downloading the archive again. It preserves an existing runtime configuration. See Requirements for both hosts’ archive, manifest and Lean executable pins.
2. Offline or custom-directory installation (--dir and --archive)
When you have downloaded the archive separately and want a custom directory, pass --dir and --archive. For example, on Apple Silicon macOS:
lema toolchain install \
--dir "$HOME/.lema/toolchains/lean-4.34.1-darwin-aarch64" \
--archive "$HOME/Downloads/lean-4.34.1-darwin_aarch64.tar.zst"On Linux x86_64:
lema toolchain install \
--dir /opt/lema/lean-4.34.1 \
--archive /var/cache/lema/lean-4.34.1-linux.tar.zstThe installer checks the archive against the current host’s committed SHA-256 pin, refuses any entry that attempts to traverse outside --dir, writes extraction-manifest.json, marks the extracted tree read-only (a-w), and checks its entire file set. A Linux archive cannot substitute for the Darwin archive.
3. Manual extraction on Linux x86_64
This example uses the Linux archive, manifest and command-line tools. On Apple Silicon, use the automatic or offline installer above, which selects the Darwin pins for you. To extract the Linux distribution by hand from a v0.3.0 lema-lang checkout:
- Create the destination directory and ensure neither it nor its parent directories are writable by group or others (
go-w):Shell DIST=$HOME/.lema/toolchains/lean-4.34.1-linux-x86_64 mkdir -p "$HOME/.lema/toolchains" chmod go-w "$HOME/.lema" "$HOME/.lema/toolchains" - Download the official Lean 4.34.1 Linux archive:
Shell curl -fLO https://github.com/leanprover/lean4/releases/download/v4.34.1/lean-4.34.1-linux.tar.zst - Verify the downloaded archive’s SHA-256 against
ARCHIVE_SHAincrates/lema-check/src/pins.rs:Shell echo "47bf4bbd78f70c2e9670598ab7124d92b6efb7330ff33e5fbb4030f6fd72e4e4 lean-4.34.1-linux.tar.zst" | sha256sum -c - - Extract the archive into
$DIST(always pass--no-same-ownerif running asrootso extracted files are owned byrootrather than the numeric UIDs recorded in the tar archive):Shell mkdir -p "$DIST" tar --zstd --no-same-owner -xf lean-4.34.1-linux.tar.zst -C "$DIST" - Copy the committed extraction manifest into
$DIST/extraction-manifest.jsonand make the entire tree read-only:Shell cp toolchain/lean-4.34.1-linux.extraction-manifest.json "$DIST/extraction-manifest.json" chmod -R a-w "$DIST" - Verify the extracted tree with
lema verify-distributionand probe the sandboxed runtime:Shell lema verify-distribution "$DIST" lema check-runtime
Troubleshooting verification refusals
| Refusal message contains | Cause and fix |
|---|---|
.../extraction-manifest.json: No such file or directory | extraction-manifest.json was not copied into the root of $DIST (Step 5), or $DIST points one directory level too deep. |
distribution manifest drift | extraction-manifest.json does not match the current host’s committed DISTRIBUTION_SHA. Use that host’s archive and manifest. |
runtime path is writable by another user: ... | A file or directory inside $DIST is writable or owned by another user. Run chmod -R a-w "$DIST". |
runtime parent is writable by another user: ... | A parent directory of $DIST is group- or world-writable without the sticky bit. Run chmod go-w on the parent directories. |
runtime path is a symlink: ... | $DIST itself is a symlink. Pass the canonical directory path instead. |
distribution file set drift or distribution file drift: ... | Extra, missing, or modified files were found inside $DIST. To wipe $DIST and reinstall cleanly, restore write permissions first: chmod -R u+w "$DIST" && rm -rf "$DIST", then run lema toolchain install. |
Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility