Skip to content
Network
Building Aptos from Source

Building Aptos From Source

CLI Binary releases are available, but if you want to build from source for an Aptos node or CLI, this is how.

Supported operating systems

Aptos can be built on various operating systems, including Linux, macOS. and Windows. Aptos is tested extensively on Linux and macOS, and less so on Windows. Here are the versions we use:

  • Linux - Ubuntu version 20.04 and 22.04
  • macOS - macOS Monterey and later
  • Microsoft Windows - Windows 10, 11 and Windows Server 2022+

Clone the Aptos-core repo

  1. Install Git. Git is required to clone the aptos-core repo, and will need to be installed prior to continuing. You can install it with the instructions on the official Git website.

  2. Clone the Aptos repository. To clone the Aptos repository (repo), you first need to open a command line prompt (Terminal on macOS / Linux, PowerShell on Windows). Then run the following command to clone the Git repository from GitHub.

    Terminal
    git clone https://github.com/aptos-labs/aptos-core.git
  3. Now let’s go into the newly created directory aptos-core by changing directory or cding into it:

    Terminal
    cd aptos-core

(Optional) Check out release branch

Optionally, check out a release branch to install an Aptos node. We suggest you check out devnet for your first development. See Choose a network for an explanation of their differences.

Release Branches
Terminal
git checkout --track origin/devnet
Terminal
git checkout --track origin/testnet
Terminal
git checkout --track origin/mainnet

Set up build dependencies

Prepare your developer environment by installing the dependencies needed to build, test and inspect Aptos Core. No matter your selected mechanism for installing these dependencies, it is imperative you keep your entire toolchain up-to-date. If you encounter issues later, update all packages and try again.

macOS

> Using the automated script

  1. Ensure you have brew package manager installed: https://brew.sh/
  2. Run the dev setup script to prepare your environment:
Terminal
./scripts/dev_setup.sh
  1. Update your current shell environment:
Terminal
source ~/.cargo/env

You can see the available options for the script by running

Terminal
./scripts/dev_setup.sh --help

> Manual installation of dependencies

If the script above doesn’t work for you, you can install these manually, but it’s not recommended.

  1. Rust
  2. CMake
  3. LLVM
  4. LLD
Linux

> Using the automated script

  1. Run the dev setup script to prepare your environment:
Terminal
./scripts/dev_setup.sh
  1. Update your current shell environment:
Terminal
source ~/.cargo/env

You can see the available options for the script by running

Terminal
./scripts/dev_setup.sh --help

> Manual installation of dependencies

If the script above does not work for you, you can install these manually, but it is not recommended:

  1. Rust.
  2. CMake.
  3. LLVM.
  4. libssl-dev and libclang-dev
Windows

> Using the automated script

  1. Open a PowerShell terminal as an administrator.
  2. Run the dev setup script to prepare your environment:
Terminal
PowerShell -ExecutionPolicy Bypass -File ./scripts/windows_dev_setup.ps1
  1. Open a new PowerShell terminal after installing all dependencies

> Manual installation of dependencies

  1. Install Rust.
  2. Install LLVM. Visit their GitHub repository for the latest prebuilt release.
  3. Install Microsoft Visual Studio Build Tools for Windows. During setup, select “Desktop development with C++” and three additional options: MSVC C++ build tools, Windows 10/11 SDK, and C++ CMake tools for Windows.
  4. If on Windows ARM, install Visual Studio.
  5. If not already installed during Visual Studio/Build Tools installation, install CMake.
  6. Open a new PowerShell terminal after installing all dependencies

Additional Tools

If you used scripts/dev_setup.sh for macOS or Linux setup, additional tools are optionally available.

Building Aptos

The simplest check that you have a working environment is to build everything and run the tests.

Terminal
cargo build
cargo test -- --skip prover

If you have already installed the Move Prover Tools above then you don’t need to skip the prover tests. To install the prover (optional), follow the Prover guide

Other documentation of specific tools has recommended patterns for cargo build and cargo run

Other resources