Docker provides a consistent environment across different platforms, making it an excellent choice for Lean development.
Install Docker:
On Linux:
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
On macOS and Windows: Download and install Docker Desktop from the official Docker website
Pull the latest Lean image:
docker pull leanprover/lean:latest
Run the Docker container:
docker run -it -v /path/to/your/local/directory:/lean leanprover/lean:latest
Inside the container, you can now use Lean:
lean --version
elan is the recommended tool for installing and managing Lean versions.
Install elan:
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh
Install the latest stable version of Lean:
elan default stable
Verify the installation:
lean --version
brew install lean
Lean is not available in the default repositories. Use elan or Docker instead.
yay -S lean4-bin
nix-env -i lean
For the latest development version or specific customizations:
Ensure you have CMake and GCC installed.
Clone the Lean repository:
git clone https://github.com/leanprover/lean4.git
cd lean4
Build and install:
mkdir build && cd build
cmake ..
make
Lean Standard Library: The standard library is included with Lean installations. To use it in your project, add
this to your leanpkg.toml
:
[dependencies]
std = {git = "https://github.com/leanprover/std4.git"}
Editor Integration:
For the most up-to-date information, always refer to the official Lean documentation.