Installing Aptos CLI
The aptos
tool is a command line interface (CLI) for developing on the Aptos blockchain, debugging Move contracts, and conducting node operations. This document describes how to install the aptos
CLI tool. See Use Aptos CLI for how to use the CLI.
To download the Aptos source code, related tools, and IDE plugins for the Move programming language, follow Getting Started.
Install the CLI by downloading the precompiled binary for your platform, as described below.
If you want to use the Move Prover to validate your Move code, install the Move Prover dependencies after installing the CLI binary.
Download precompiled binary
macOS
macOS
These instructions have been tested on macOS Monterey (12.6)
Go to the Aptos CLI Release list.
Click the Assets expandable menu for the latest release.
You will see the zip files with the filename of the format:
aptos-cli-<version>-<platform>
. These are the platform-specific pre-compiled binaries of the CLI. Download the zip file for your platform, dismissing any warnings.Unzip the downloaded file. This will extract the
aptos
CLI binary file into your default downloads folder. For example, on macOS it is the~/Downloads
folder.Move this extracted
aptos
binary file into your preferred local folder. For example, place it in the~/bin/aptos
folder on macOS to make it accessible from the command line.:::tip Upgrading? Remember to look in the default download folder When you update the CLI binary with the latest version, note that the newer version binary will be downloaded to your default Downloads folder. Remember to move this newer version binary from the Downloads folder to the
~/bin/aptos
folder to update and overwrite the older version. :::Make this
~/bin/aptos
an executable by running this command:chmod +x ~/bin/aptos
.- On macOS when you attempt to run the
aptos
tool for the first time, you will be blocked by the macOS that this app is from an "unknown developer". This is normal. Follow the simple steps recommended by the Apple support in Open a Mac app from an unidentified developer to remove this blocker.
Type
~/bin/aptos help
to read help instructions.Add
~/bin
to your path in your.bashrc
or.zshrc
file for future use.
Linux
Linux
These instructions have been tested on Ubuntu 20.04.
Go to the Aptos CLI release page.
Click the Assets expandable menu for the latest release.
You will see the zip files with the filename of the format:
aptos-cli-<version>-<platform>
. These are the platform-specific pre-compiled binaries of the CLI. Download the zip file for your platform, dismissing any warnings.Unzip the downloaded file. This will extract the
aptos
CLI binary file into your default downloads folder.Move this extracted
aptos
binary file into your preferred local folder.Upgrading? Remember to look in the default download folderWhen you update the CLI binary with the latest version, note that the newer version binary will be downloaded to your default Downloads folder. Remember to move this newer version binary from the Downloads folder to
~/bin/aptos
folder (overwriting the older version).Make this
~/bin/aptos
an executable by running this command:chmod +x ~/bin/aptos
.
Type
~/bin/aptos help
to read help instructions.Add
~/bin
to your path in your.bashrc
or.zshrc
file for future use.
Windows 10, 11 and Windows Server 2022+
Windows 10, 11 and Windows Server 2022+
These instructions have been tested on Windows 11 and Windows Server 2022. Windows support is new and some features may be not complete. Open Github issues for bugs.
- Go to the Aptos CLI release page.
- Click the Assets expandable menu for the latest release.
- You will see the zip files with the filename of the format:
aptos-cli-<version>-<platform>
. These are the platform-specific pre-compiled binaries of the CLI. Download the zip file for your platform, dismissing any warnings. - Unzip the downloaded file. This will extract the
aptos
CLI binary file into your default downloads folder. For example, on Windows it is the\Users\user\Downloads
folder. - Move this extracted
aptos
binary file into your preferred local folder.Upgrading? Remember to look in the default download folderWhen you update the CLI binary with the latest version, note that the newer version binary will be downloaded to your default Downloads folder. Remember to move this newer version binary from the Downloads folder to your preferred location.
- Open a powershell terminal via the windows start menu
- In the powershell terminal, you can get help instructions by running the command with help. For example
.\Downloads\aptos-cli-0.3.5-Windows-x86_64\aptos.exe help
to read help instructions.
(Optional) Install the dependencies of Move Prover
If you want to use the Move Prover, install the dependencies by following the below steps:
Currently, Windows is not supported by the Move Prover.
Prover macOS installation
macOS
These instructions have been tested on macOS Monterey (12.6)
Ensure you have
brew
installed https://brew.sh/.Ensure you have
git
installed https://git-scm.com/book/en/v2/Getting-Started-Installing-Git.Clone the Aptos core repo:
git clone https://github.com/aptos-labs/aptos-core.git
.Change directory into
aptos-core
:cd aptos-core
Run the dev setup script to prepare your environment:
./scripts/dev_setup.sh -yp
Source the profile file:
source ~/.profile
.infoNote that you have to include environment variable definitions in
~/.profile
into your shell. Depending on your setup, the~/.profile
may be already automatically loaded for each login shell, or it may not. If not, you may need to add. ~/.profile
to your~/.bash_profile
or other shell configuration manually.You can now run the Move Prover to prove an example:
aptos move prove --package-dir aptos-move/move-examples/hello_prover/
Prover Linux installation
Linux
Some Linux distributions are not supported. Currently, OpenSUSE and Amazon Linux do not support the automatic installation via the dev_setup.sh
script.
Ensure you have
git
installed https://git-scm.com/book/en/v2/Getting-Started-Installing-Git.Clone the Aptos core repo:
git clone https://github.com/aptos-labs/aptos-core.git
.Change directory into
aptos-core
:cd aptos-core
Run the dev setup script to prepare your environment:
./scripts/dev_setup.sh -yp
Source the profile file:
source ~/.profile
.infoNote that you have to include environment variable definitions in
~/.profile
into your shell. Depending on your setup, the~/.profile
may be already automatically loaded for each login shell, or it may not. If not, you may need to add. ~/.profile
to your~/.bash_profile
or other shell configuration manually.You can now run the Move Prover to prove an example:
aptos move prove --package-dir aptos-move/move-examples/hello_prover/
(Advanced users only) Build the CLI binary from the source code
If you are an advanced user and would like to build the CLI binary by downloading the source code, follow the below steps. This is not recommended unless you are on a platform unsupported by the prebuilt binaries.
macOS
macOS
Setup dependencies
> Using the automated script
- If on Mac, ensure you have
brew
installed https://brew.sh/ - Ensure you have
git
installed https://git-scm.com/book/en/v2/Getting-Started-Installing-Git. - Clone the Aptos core repo:
git clone https://github.com/aptos-labs/aptos-core.git
. - Change directory into
aptos-core
:cd aptos-core
- Run the dev setup script to prepare your environment:
./scripts/dev_setup.sh
- Update your current shell environment:
source ~/.cargo/env
.
> Manual installation of dependencies
If the script above doesn't work for you, you can install these manually, but it's not recommended.
Building the Aptos CLI
- Checkout the correct branch
git checkout --track origin/<branch>
, where<branch>
is:devnet
for building on the Aptos devnet.testnet
for building on the Aptos testnet.main
for the current development branch.
- Build the CLI tool:
cargo build --package aptos --release
. - The binary will be available in at
target/release/aptos
- (Optional) Move this executable to a place on your path e.g.
~/bin/aptos
. - You can now get help instructions by running
~/bin/aptos help
Linux
Linux
Setup dependencies
> Using the automated script
- If on Mac, ensure you have
brew
installed https://brew.sh/ - Ensure you have
git
installed https://git-scm.com/book/en/v2/Getting-Started-Installing-Git. - Clone the Aptos core repo:
git clone https://github.com/aptos-labs/aptos-core.git
. - Change directory into
aptos-core
:cd aptos-core
- Run the dev setup script to prepare your environment:
./scripts/dev_setup.sh
- Update your current shell environment:
source ~/.cargo/env
> Manual installation of dependencies
If the script above does not work for you, you can install these manually, but it is not recommended:
Building the Aptos CLI
- Checkout the correct branch
git checkout --track origin/<branch>
, where<branch>
is:devnet
for building on the Aptos devnet.testnet
for building on the Aptos testnet.main
for the current development branch.
- Build the CLI tool:
cargo build --package aptos --release
. - The binary will be available in at
target/release/aptos
- (Optional) Move this executable to a place on your path e.g.
~/bin/aptos
. - You can now get help instructions by running
~/bin/aptos help
Windows
Windows
Setup dependencies
The aptos-core codebase currently has no script similar to the dev_setup.sh
script for
Windows. All dependencies must be manually installed.
> Manual installation of dependencies
- Install Rust.
- Install Git.
- Install CMake.
- If on Windows ARM, install Visual Studio Preview.
- Install C++ build tools for Windows.
- Install LLVM.
Building aptos-core
- Checkout the correct branch
git checkout --track origin/<branch>
, where<branch>
is:devnet
for building on the Aptos devnet.testnet
for building on the Aptos testnet.main
for the current development branch.
- Build the CLI tool:
cargo build --package aptos --release
. - The binary will be available at -
target\release\aptos.exe
- You can now get help instructions by running
target\release\aptos.exe
in a Powershell window.