Install Dependencies

A guide to setting up your local Solana development environment. Learn how to install Rust, the Solana CLI, and Anchor Framework on Windows (WSL), Linux, and Mac. Use this guide if you prefer to install each dependency individually, or if the quick installation fails for any reason.

Prerequisites

Install Rust

Developers build Solana programs using the Rust programming language.

  1. Install Rust using rustup by entering the following command in your terminal:
Terminal
$
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

After a successful installation you will see the following message:

  1. Reload your PATH environment variable to include Cargo's bin directory:
Terminal
$
. "$HOME/.cargo/env"
  1. Verify that the installation was successful.
Terminal
$
rustc --version

You will see output like the following:

rustc 1.86.0 (05f9846f8 2025-03-31)

Install Solana CLI

The Solana CLI provides all the tools required to build and deploy Solana programs.

  1. Install the Solana CLI tool suite by using the official install command:
Terminal
$
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"

You can replace stable with the release tag matching the software version of your desired release (i.e. v2.0.3), or use one of the three symbolic channel names: stablebeta, or edge.

  1. Add a PATH environment variable

A first-time installation of the Solana CLI, may prompt you to add a PATH environment variable. To do so, close and reopen your terminal or run the following in your shell:

export PATH="/Users/test/.local/share/solana/install/active_release/bin:$PATH"
  1. Update your PATH environment variable

If you are using Linux or WSL, you must add the Solana CLI binary to your PATH so that the command is available in your terminal. To do so, follow the steps below:

a. Check which shell you are using:

Terminal
$
echo $SHELL
  • If the output contains /bash, use .bashrc.
  • If the output contains /zsh, use .zshrc.

b. Run the appropriate command, based on your shell.

For Bash (bashrc):

Terminal
$
echo 'export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.bashrc
$
source ~/.bashrc

For Zsh (zshrc):

Terminal
$
echo 'export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.zshrc
$
source ~/.zshrc
  1. Restart your terminal or run the following command to refresh the terminal session:
Terminal
$
source ~/.bashrc # If using Bash
$
source ~/.zshrc # If using Zsh
  1. Verify that the installation succeeded by checking the Solana CLI version:
Terminal
$
solana --version

You will see output like the following:

solana-cli 2.2.12 (src:0315eb6a; feat:1522022101, client:Agave)

You can view all available versions on the Agave Github repo. Agave is the validator client from Anza, formerly known as Solana Labs validator client.

  1. Update the Solana CLI to the latest version, as needed (Optional)
Terminal
$
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

The default Anchor project test file (TypeScript) created with the anchor init command requires Node.js and Yarn. (The Rust test template is available using anchor init --test-template rust)

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:

  1. Install AVM with the following command:
Terminal
$
cargo install --git https://github.com/solana-foundation/anchor avm --force
  1. Confirm that AVM installed successfully:
Terminal
$
avm --version
  1. Install Anchor CLI using AVM:

To install the latest version:

Terminal
$
avm install latest
$
avm use latest

To install a specific version, specify the version number:

Terminal
$
avm install 0.30.1
$
avm use 0.30.1

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:

  1. Install the dependencies listed in the Linux section at the top of this page.
  2. Retry installing the Anchor CLI.
  1. Verify that the installation succeeded, by checking the Anchor CLI version:
Terminal
$
anchor --version

You will see output like the following:

anchor-cli 0.31.1

Don't forget to run the avm use command to declare the Anchor CLI version to run on your system.

  • If you installed the latest version, run avm use latest.
  • If you installed the version 0.30.1, run avm use 0.30.1.

Setting up AI Tooling for Solana development

This section details optional AI tooling setup you can use to accelerate your Solana development.

ToolDescriptionLink
MCPMCP server that you can connect to with cursor to improve Solana AI assisted development.https://mcp.solana.com/
LLMs.txtLLM optimized documentation that you can use to train LLMs on Solana docs.https://solana.com/llms.txt

Is this page helpful?

सामग्री तालिका

पृष्ठ संपादित करें
Install the dependencies necessary to develop with Solana | Solana