Install each dependency separately when you need a specific version or when the quick installation does not complete successfully. Follow the sections in order for a new environment, or go directly to the tool you need to install or troubleshoot.
Prerequisites
Install Rust
Developers build Solana programs using the Rust programming language.
- Install Rust using rustup by entering the following command in your terminal:
$curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
After a successful installation you will see the following message:
- Reload your PATH environment variable to include Cargo's bin directory:
$. "$HOME/.cargo/env"
- Verify that the installation was successful.
$rustc --version
The command prints the installed Rust version, for example:
rustc x.y.z (...)
Install Solana CLI
The Solana CLI provides all the tools required to build and deploy Solana programs.
- Install the Solana CLI tool suite by using the official install command:
$sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
You can replace stable with a specific Agave release tag or with the beta
or edge release channel.
- Make the Solana CLI available in your current terminal.
The installer updates your shell configuration and prints the command required to update the current session. The command is typically:
$export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
If solana is still unavailable, restart your terminal. To confirm which shell
configuration file the installer updated, check your current shell:
$echo $SHELL
- If the output contains
/bash, restart the terminal or runsource ~/.bashrc. - If the output contains
/zsh, restart the terminal or runsource ~/.zshrc.
- Verify that the installation succeeded:
$solana --version
The command prints the installed Solana CLI version, for example:
solana-cli x.y.z (..., client:Agave)
You can view all available versions on the Agave GitHub repository. Agave is the validator client from Anza, formerly known as Solana Labs validator client.
- To update the Solana CLI later, run:
$agave-install update
Install Anchor CLI
Anchor is a framework for developing Solana programs. The Anchor framework leverages Rust macros to simplify the process of writing Solana programs.
Prerequisites
Node.js and a JavaScript package manager are required only when you select a TypeScript test template such as Mocha or Jest. The default LiteSVM test template runs in Rust and does not require Node.js tooling.
Installation
You can install the Anchor CLI and tooling in two ways:
- Anchor Version Manager (AVM) — Recommended installation method
- Without AVM — Install directly from GitHub
The Anchor Version Manager (AVM) allows you to install and manage different Anchor versions on your system and easily update Anchor versions in the future. To install Anchor using AVM, follow the steps below:
- Install AVM with the following command:
$curl -sSfL https://raw.githubusercontent.com/otter-sec/anchor/master/avm/install | sh
- Confirm that AVM installed successfully:
$avm --version
- Install Anchor CLI using AVM:
To install the latest version:
$avm install latest$avm use latest
To install a specific version, specify the version number:
$avm install 1.1.2$avm use 1.1.2
When installing the Anchor CLI on Linux or WSL, you may encounter this error:
error: could not exec the linker cc = note: Permission denied (os error 13)
If you see this error message, follow these steps:
- Install the dependencies listed in the Linux section at the top of this page.
- Retry installing the Anchor CLI.
- Verify that the installation succeeded, by checking the Anchor CLI version:
$anchor --version
The command prints the active Anchor CLI version, for example:
anchor-cli 1.1.2
Run avm use to select the Anchor CLI version for your system.
- If you installed the latest version, run
avm use latest. - If you installed version
1.1.2, runavm use 1.1.2.
Install Surfpool CLI
Surfpool is a tool for local development and an improved
replacement for solana-test-validator.
- Install Surfpool with the following command:
$curl --proto '=https' --tlsv1.2 -sSfL https://run.surfpool.run/ | bash
- Verify that the installation was successful by checking the Surfpool CLI version:
$surfpool --version
The command prints the installed Surfpool CLI version, for example:
surfpool x.y.z
Is this page helpful?