GitHub

Getting Started

Installation

Rust

Go here to install Rust.

You should know!

We recommend reading chapters 1-9 of the Rust book which cover the basics of using Rust (Most of the time you don't need advanced Rust to write anchor programs).

Solana

Go here to install Solana and then run solana-keygen new to create a keypair at the default location. Anchor uses this keypair to run your program tests.

You should know!

We also recommend checking out the the official Solana developers page.

Yarn

Go here to install Yarn.

Anchor

Anchor version manager is a tool for using multiple versions of the anchor-cli. It will require the same dependencies as building from source. It is recommended you uninstall the NPM package if you have it installed.

Install avm using Cargo. Note this will replace your anchor binary if you had one installed.

cargo install --git https://github.com/coral-xyz/anchor avm --locked --force

On Linux systems you may need to install additional dependencies if cargo install fails. E.g. on Ubuntu:

sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev

Install the latest version of the CLI using avm, and then set it to be the version to use.

avm install latest
avm use latest

Verify the installation.

anchor --version

Install using pre-build binary on x86_64 Linux

Anchor binaries are available via an NPM package @project-serum/anchor-cli. Only x86_64 Linux is supported currently, you must build from source for other OS'.

Build from source for other operating systems without avm

We can also use Cargo to install the CLI directly. Make sure that the --tag argument uses the version you want (the version here is just an example).

cargo install --git https://github.com/coral-xyz/anchor --tag v0.24.1 anchor-cli --locked

On Linux systems you may need to install additional dependencies if cargo install fails. On Ubuntu,

sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev

Now verify the CLI is installed properly.

anchor --version
Previous
Introduction