This webpage is about Lean 3, which is currently being deprecated, while the community is migrating to Lean 4.
Jump to the corresponding page on the main Lean 4 website.
How to install Lean and mathlib on MacOS #
This document explains how to get started with Lean and mathlib if you are using MacOS.
If you get stuck, please come to the chat room to ask for assistance.
There is a video walkthrough of these instructions on YouTube.
Installing Lean and mathlib #
Intel Macs #
Here we will discuss the fast way, assuming a lot of trust from you. It
will install Lean, with supporting tools
the supporting tool
leanproject for Lean's mathematical
library, as well as the code editor VS Code and its Lean plugin.
If you don't like this method, there is a
detailed webpage which will decompose the
process into described stages, and won't ask for a blind
The fast way is: open a terminal and type:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/leanprover-community/mathlib-tools/master/scripts/install_macos.sh)" && source ~/.profile
M1 Macs / Apple Silicon #
Given that GitHub Actions does not yet support builds on Apple ARM, installation of Lean is for the moment a bit more complex.
elan – which is installed
as part of the above instructions – will not be able to fetch Lean binaries on
these devices if installed the normal way.
Open a new terminal window and install XCode Command Line Tools and Rosetta 2 using
We will install a second, separate x86 installation of Homebrew, which is easiest done by running a shell entirely using Rosetta 2. Do so by running
arch -x86_64 zsh. The remainder of the commands below should be run from within this
x86-running window, though once the steps have been completed, the installed tools will work in any future shell.
Install a second installation of Homebrew for
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". It will automatically install itself into a second location (
/usr/local, rather than
Follow the same steps described in Controlled Installation for macOS using the
brewyou just installed:
/usr/local/bin/brew install elan-init mathlibtools elan toolchain install stable elan default stable
- Install Visual Studio Code and the Lean extension via
brew install --cask visual-studio-code && code --install-extension jroesch.lean(both the x86 and ARM versions of
There is a Zulip thread with some interim further details and advice. If you have trouble, feel free to ask for help.
Lean Projects #
You can now read instructions about creating and working on Lean projects
If you encounter any
command not found errors when opening a new terminal,
logging out from MacOS and logging in again should fix it.