Building Aptos From Source
Binary releases are available, but if you want to build from source or develop on the Aptos tools, 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
-
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.
-
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.
git clone https://github.com/aptos-labs/aptos-core.git
-
Now let's go into the newly created directory
aptos-core
by changing directory orcd
ing into it: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
- Devnet
- Testnet
- Mainnet
git checkout --track origin/devnet
git checkout --track origin/testnet
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
- Ensure you have
brew
package manager installed: https://brew.sh/ - Run the dev setup script to prepare your environment:
./scripts/dev_setup.sh
- Update your current shell environment:
source ~/.cargo/env
.
You can see the available options for the script by running ./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.
Linux
> Using the automated script
- Run the dev setup script to prepare your environment:
./scripts/dev_setup.sh
- Update your current shell environment:
source ~/.cargo/env
You can see the available options for the script by running ./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:
- Rust.
- CMake.
- LLVM.
- libssl-dev and libclang-dev
Windows
> Using the automated script
- Open a PowerShell terminal as an administrator.
- Run the dev setup script to prepare your environment:
PowerShell -ExecutionPolicy Bypass -File ./scripts/windows_dev_setup.ps1
- Open a new PowerShell terminal after installing all dependencies
> Manual installation of dependencies
- Install Rust.
- Install LLVM. Visit their GitHub repository for the latest prebuilt release.
- 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.
- If on Windows ARM, install Visual Studio.
- If not already installed during Visual Studio/Build Tools installation, install CMake.
- 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.
TypeScript
Using the released SDK can be achieved from npm/pnpm/yarn.
Building Aptos
The simplest check that you have a working environment is to build everything and run the tests.
cargo build
cargo test -- --skip prover
If you installed the Move Prover Tools above then you don't need to skip the prover tests.
Other documentation of specific tools has recommended patterns for cargo build
and cargo run