---
title: Install Dependencies
seoTitle: Install the dependencies necessary to develop with Solana
description:
  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.
---

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](/docs/intro/installation/) fails for any reason.

### Prerequisites

<Accordions>
<Accordion title="Windows">

To develop Solana programs on Windows you **must** use
[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install)
(WSL). After installing WSL, all other dependencies will be installed through
the Linux terminal.

To install WSL, run the following command in Windows PowerShell:

```terminal
$ wsl --install
```

The installation process will prompt you to create a default user account.

![WSL Install](/assets/docs/intro/installation/wsl-install.png)

By default, WSL installs Ubuntu. You can open a Linux terminal by searching
"Ubuntu" in the Search bar.

![WSL Ubuntu](/assets/docs/intro/installation/wsl-ubuntu-search.png)

If your Ubuntu terminal looks like the image below, you may encounter an issue
where `ctrl + v` (paste keyboard shortcut) doesn't work in the terminal.

![Ubuntu Terminal](/assets/docs/intro/installation/wsl-ubuntu-terminal-1.png)

If you encounter this issue, open Windows Terminal by searching for "Terminal"
in the Search bar.

![Windows Terminal](/assets/docs/intro/installation/wsl-windows-terminal.png)

Next, close the Windows Terminal and reopen a Linux terminal by searching for
Ubuntu again. The terminal should now look like the image below, where
`ctrl + v` (paste keyboard shortcut) works.

![Ubuntu Terminal](/assets/docs/intro/installation/wsl-ubuntu-terminal-2.png)

If you use VS Code, the
[WSL extension](https://code.visualstudio.com/docs/remote/wsl-tutorial) enables
you to use WSL and VS Code together.

![WSL Setup in VS Code](/assets/docs/intro/installation/wsl-vscode.png)

You will see the following in the VS Code status bar:

![WSL: Ubuntu](/assets/docs/intro/installation/wsl-vscode-ubuntu.png)

Once you have WSL set up, you are ready to either:

- Complete the [quick installation](/docs/intro/installation) using the Ubuntu
  (Linux) terminal
- Install [Rust](#install-rust), the [Solana CLI](#install-solana-cli), and the
  [Anchor CLI](#install-anchor-cli) individually, as described below

</Accordion>
<Accordion title="Linux">

<Tabs items={[".deb", ".rpm"]}>
<Tab value=".deb" >
If on Debian or Debian-derived alternatives like Ubuntu or Mint, follow the steps below:

1. Update the package lists to ensure all the packages are up-to-date:

```terminal
$ sudo apt-get update
```

2. Install the following dependencies:

```terminal
$ sudo apt-get install -y \
    build-essential \
    pkg-config \
    libudev-dev llvm libclang-dev \
    protobuf-compiler libssl-dev
```

<Callout>
If you encounter the following error when installing `protobuf-compiler`, make
sure you first run _shell`sudo apt-get update`

```
Package protobuf-compiler is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
```

</Callout>

  </Tab>

    <Tab value=".rpm" >
    For RHEL derivatives like Fedora or Red Hat Linux, follow the following steps.

Update the package lists to get the newer versions of packages by running the
command.

```terminal
$ sudo dnf upgrade --refresh
```

Next, install the following dependencies:

```terminal
$ sudo dnf group install c-development development-tools \
&& sudo dnf install pkg-config openssl-devel
```

  </Tab>
</Tabs>

</Accordion>
</Accordions>

<Steps>
<Step>

### Install Rust

Developers build Solana programs using the [Rust](https://www.rust-lang.org/)
programming language.

1. Install Rust using [rustup](https://www.rust-lang.org/tools/install) 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:

<Accordions>
<Accordion title="Successful Rust Install Message">

```
Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, you need to source
the corresponding env file under $HOME/.cargo.

This is usually done by running one of the following (note the leading DOT):
. "$HOME/.cargo/env"            # For sh/bash/zsh/ash/dash/pdksh
source "$HOME/.cargo/env.fish"  # For fish
```

</Accordion>
</Accordions>

2. Reload your PATH environment variable to include
   [Cargo's](https://github.com/rust-lang/cargo) bin directory:

```terminal
$ . "$HOME/.cargo/env"
```

3. Verify that the installation was successful.

```terminal
$ rustc --version
```

You will see output like the following:

```
rustc 1.86.0 (05f9846f8 2025-03-31)
```

</Step>
<Step>

### 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)"
```

<Callout>
  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`.
</Callout>

2. 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"
```

3. Update your PATH environment variable

<Tabs groupId="language" items={["Windows & Linux", "Mac"]}>
<Tab value="Windows & Linux">

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
```

</Tab>
<Tab value="Mac">

If you use a Mac with `zsh`, running the default `export PATH` command logged
from the installation doesn't persist once you close your terminal. Instead, add
the PATH to your shell configuration file by running the following command:

```terminal
$ echo 'export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.zshrc
```

<Callout>
  The steps above do not apply to `bash` users, as the changes to the PATH
  variable will persist by default.
</Callout>

</Tab>
</Tabs>

4. Restart your terminal or run the following command to refresh the terminal
   session:

```terminal
$ source ~/.bashrc # If using Bash
$ source ~/.zshrc # If using Zsh
```

5. 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)
```

<Callout>

You can view all available versions on the
[Agave Github repo](https://github.com/anza-xyz/agave/releases). Agave is the
validator client from [Anza](https://www.anza.xyz/), formerly known as Solana
Labs validator client.

</Callout>

5. Update the Solana CLI to the latest version, as needed _(Optional)_

```terminal
$ agave-install update
```

</Step>
<Step>

### Install Anchor CLI

[Anchor](https://www.anchor-lang.com/) 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
_shell`anchor init`_ command requires Node.js and Yarn. (The Rust test template
is available using _shell`anchor init --test-template rust`_)

<Accordions>
<Accordion title="Node Installation">

1. Install Node using
   [Node Version Manager (nvm)](https://github.com/nvm-sh/nvm) by running the
   following command:

```terminal
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
```

2. Restart your terminal and confirm that the `nvm` command runs successfully:

```terminal
$ command -v nvm
```

3. Use `nvm` to install Node:

```terminal
$ nvm install node
```

4. Verify that the installation succeeded, by checking the Node version:

```terminal
$ node --version
```

You will see output like the following:

```
v23.7.0
```

</Accordion>
<Accordion title="Yarn Installation">

1. Install Yarn:

```terminal
$ npm install --global yarn
```

2. Verify that the installation succeeded, by checking the Yarn version:

```terminal
$ yarn --version
```

You will see the following output:

```
1.22.1
```

</Accordion>
</Accordions>

#### 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

<Tabs groupId="anchor" items={["AVM", "Without AVM"]}>
<Tab value="AVM">

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
```

2.  Confirm that AVM installed successfully:

```terminal
$ avm --version
```

3. 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
```

<Callout type="warn">

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](/docs/intro/installation/dependencies) section at the top of this
   page.
2. Retry installing the Anchor CLI.

</Callout>

4. 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
```

<Callout type="info">

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

- If you installed the `latest` version, run _shell`avm use latest`_.
- If you installed the version `0.30.1`, run _shell`avm use 0.30.1`_.

</Callout>

</Tab>

<Tab value="Without AVM">

1. Install a specific version of the Anchor CLI with the following command:

```terminal
$ cargo install --git https://github.com/solana-foundation/anchor --tag v0.30.1 anchor-cli
```

2. 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
```

</Tab>
</Tabs>

</Step>
<Step>

### Install Surfpool CLI

[Surfpool](https://surfpool.run/) is a tool for local development and an
improved replacement for `solana-test-validator`. Learn more about Surfpool
features in the [Surfpool documentation](https://docs.surfpool.run/).

1. Install Surfpool with the following command:

```terminal
$ curl -sL https://run.surfpool.run/ | bash
```

2. Verify that the installation was successful by checking the Surfpool CLI
   version:

```terminal
$ surfpool --version
```

You will see output like the following:

```
surfpool 0.12.0
```

</Step>
</Steps>
