Skip to main content
This guide covers the steps to set up your local environment for Solana development with Anchor.

Quick installation

On Mac and Linux, run this single command to install all dependencies:
curl --proto '=https' --tlsv1.2 -sSfL https://solana-install.solana.workers.dev | bash
Windows users must first install WSL (see Install Dependencies). Then run the command above in the Ubuntu (Linux) terminal.
After installation, you should see output similar to:
Installed Versions:
Rust: rustc 1.85.0 (4d91de4e4 2025-02-17)
Solana CLI: solana-cli 2.1.15 (src:53545685; feat:3271415109, client:Agave)
Anchor CLI: anchor-cli 0.32.1
Node.js: v23.9.0
Yarn: 1.22.1

Installation complete. Please restart your terminal to apply all changes.
If the quick installation doesn’t work, refer to the Install Dependencies section below for instructions to install each dependency individually.If the quick install succeeds, skip to Solana CLI Basics and Anchor CLI Basics.

Install dependencies

The instructions below guide you through installing each dependency individually.
  • Windows users: First install WSL (Windows Subsystem for Linux), then install the dependencies specified in the Linux section
  • Linux users: First install the dependencies specified in the Linux section below
  • Mac users: Start with the Rust installation instructions

Windows Subsystem for Linux (WSL)

To develop Solana programs on Windows, you must use WSL. All additional dependencies must be installed through the Linux terminal. To install WSL, run this command in Windows PowerShell:
wsl --install
By default, WSL installs Ubuntu. Open a Linux terminal by searching “Ubuntu” in the search bar.
If you’re using VS Code, the WSL extension enables you to use WSL and VS Code together.

Linux dependencies

The following dependencies are required for the Anchor CLI installation. First, update your package manager:
sudo apt-get update
Next, install the required dependencies:
sudo apt-get install -y \
    build-essential \
    pkg-config \
    libudev-dev llvm libclang-dev \
    protobuf-compiler libssl-dev
1
Install Rust
2
Solana programs are written in the Rust programming language.
3
The recommended installation method for Rust is rustup.
4
Run the following command to install Rust:
5
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
6
Reload your PATH environment variable:
7
. "$HOME/.cargo/env"
8
Verify the installation:
9
rustc --version
10
You should see output similar to:
11
rustc 1.84.1 (e71f9a9a9 2025-01-27)
12
Install Solana CLI
13
The Solana CLI provides all the tools required to build and deploy Solana programs.
14
Install the Solana CLI tool suite:
15
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
16
You can replace stable with a specific release tag (e.g., v2.0.3) or use beta or edge.
17
If prompted, add the PATH environment variable:
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
On Mac using zsh, add the PATH to your shell configuration:
echo 'export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.zshrc
Then refresh your terminal session:
source ~/.zshrc
18
Verify the installation:
19
solana --version
20
You should see output similar to:
21
solana-cli 2.0.26 (src:3dccb3e7; feat:607245837, client:Agave)
22
To update the Solana CLI later:
23
agave-install update
24
Install Anchor CLI
25
Anchor is a framework for developing Solana programs. The Anchor framework leverages Rust macros to simplify the process of writing Solana programs.
26
There are two ways to install the Anchor CLI:
27
  • Anchor Version Manager (AVM) - Recommended
  • Without AVM - Install directly from GitHub
  • 28
    The Anchor version manager (AVM) allows you to install and manage different Anchor versions.Install AVM:
    cargo install --git https://github.com/coral-xyz/anchor avm --force
    
    Check that AVM was installed successfully:
    avm --version
    
    Install the latest version of Anchor CLI:
    avm install latest
    avm use latest
    
    Alternatively, install a specific version:
    avm install 0.32.1
    avm use 0.32.1
    
    Don’t forget to run avm use to declare which Anchor CLI version should be used on your system.
    Install a specific version of the Anchor CLI:
    cargo install --git https://github.com/coral-xyz/anchor --tag v0.32.1 anchor-cli
    
    29
    Verify the installation:
    30
    anchor --version
    
    31
    You should see output similar to:
    32
    anchor-cli 0.32.1
    
    33
    Node.js and Yarn
    34
    Node.js and Yarn are required to run the default Anchor project test file (TypeScript) created with the anchor init command.
    35
    Install Node.js:
    36
    The recommended way to install Node.js is using Node Version Manager (nvm):
    37
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
    
    38
    Restart your terminal and verify nvm is installed:
    39
    command -v nvm
    
    40
    Use nvm to install Node:
    41
    nvm install node
    
    42
    Verify the installation:
    43
    node --version
    
    44
    Install Yarn:
    45
    npm install --global yarn
    
    46
    Verify the installation:
    47
    yarn --version
    

    Solana CLI basics

    This section walks through common Solana CLI commands to get you started.
    1
    Solana config
    2
    View your current config:
    3
    solana config get
    
    4
    You should see output similar to:
    5
    Config File: /Users/test/.config/solana/cli/config.yml
    RPC URL: https://api.mainnet-beta.solana.com
    WebSocket URL: wss://api.mainnet-beta.solana.com/ (computed)
    Keypair Path: /Users/test/.config/solana/id.json
    Commitment: confirmed
    
    6
    Update the Solana CLI cluster:
    7
    solana config set --url mainnet-beta
    solana config set --url devnet
    solana config set --url localhost
    solana config set --url testnet
    
    8
    Or use short options:
    9
    solana config set -um    # For mainnet-beta
    solana config set -ud    # For devnet
    solana config set -ul    # For localhost
    solana config set -ut    # For testnet
    
    10
    Create wallet
    11
    To interact with the Solana network, you need a wallet funded with SOL.
    12
    Generate a keypair at the default location:
    13
    solana-keygen new
    
    14
    Get the address (public key) of your keypair:
    15
    solana address
    
    16
    Airdrop SOL
    17
    Request an airdrop of SOL to fund your wallet on devnet:
    18
    solana config set -ud
    solana airdrop 2
    
    19
    Check your wallet’s SOL balance:
    20
    solana balance
    
    21
    The solana airdrop command is limited to 5 SOL per request on devnet. Alternatively, use the Solana Web Faucet.
    22
    Run local validator
    23
    Run a local validator to deploy and test programs locally:
    24
    solana-test-validator
    
    25
    In a separate terminal, update the Solana CLI config to localhost:
    26
    solana config set -ul
    

    Anchor CLI basics

    This section walks through common Anchor CLI commands.
    1
    Initialize project
    2
    Create a new Anchor project:
    3
    anchor init <project-name>
    
    4
    For example:
    5
    anchor init my-project
    
    6
    This creates a new directory with a modular Rust program structure and TypeScript test template.
    7
    Navigate to the project directory:
    8
    cd my-project
    
    9
    Build program
    10
    Build your project:
    11
    anchor build
    
    12
    The compiled program will be in /target/deploy.
    13
    Deploy program
    14
    Deploy your project:
    15
    anchor deploy
    
    16
    This deploys your program to the cluster specified in the Anchor.toml file.
    17
    Test program
    18
    Test your project:
    19
    anchor test
    
    20
    This command builds, deploys, and runs tests. When using localnet, Anchor automatically starts a local validator, deploys your program, runs tests, and stops the validator.

    Next steps

    Now that you have your development environment set up, continue to the Quickstart guide to build your first Anchor program.

    Build docs developers (and LLMs) love