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.
- 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
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.
- 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 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: stable
, beta
, or edge
.
- 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"
- 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:
$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
):
$echo 'export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.bashrc$source ~/.bashrc
For Zsh (zshrc
):
$echo 'export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.zshrc$source ~/.zshrc
- Restart your terminal or run the following command to refresh the terminal session:
$source ~/.bashrc # If using Bash$source ~/.zshrc # If using Zsh
- Verify that the installation succeeded by checking the Solana CLI version:
$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.
- Update the Solana CLI to the latest version, as needed (Optional)
$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:
- Install AVM with the following command:
$cargo install --git https://github.com/solana-foundation/anchor avm --force
- 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 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:
- 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
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, runavm use latest
. - If you installed the version
0.30.1
, runavm 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.
Tool | Description | Link |
---|---|---|
MCP | MCP server that you can connect to with cursor to improve Solana AI assisted development. | https://mcp.solana.com/ |
LLMs.txt | LLM optimized documentation that you can use to train LLMs on Solana docs. | https://solana.com/llms.txt |
Is this page helpful?