> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

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

Install each dependency separately when you need a specific version or when the
[quick installation](/developers/docs/quickstart) 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

Pick your operating system. The steps after this section are the same on every
system.

<div className="sol-os-tabs">
<Tabs>
<Tab title="macOS">

Rust needs a C compiler and linker. On macOS they come with Apple's
command-line developer tools. If you don't have them yet, install them in
Terminal:

```bash Terminal
xcode-select --install
```

Then continue with [Install Rust](#install-rust).

</Tab>
<Tab title="Linux">


<Tabs>
<Tab title=".deb">
On Debian or a Debian-derived distribution such as Ubuntu or Mint:

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

```bash Terminal
sudo apt-get update
```

2. Install the following dependencies:

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

<Note>
If you encounter the following error when installing `protobuf-compiler`, run
`sudo apt-get update` before retrying the installation command.

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

</Note>

  </Tab>

    <Tab title=".rpm">
    On an RPM-based distribution such as Fedora or Red Hat Enterprise Linux:

Update installed packages:

    ```bash Terminal
    sudo dnf upgrade --refresh
    ```

    Install the development dependencies:

    ```bash Terminal
    sudo dnf group install c-development development-tools \
    && sudo dnf install pkg-config openssl-devel
    ```

  </Tab>
</Tabs>

</Tab>
<Tab 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:

```bash Terminal
wsl --install
```

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

<Frame caption="WSL Install">
  ![WSL Install](/docs-assets/assets/docs/intro/installation/wsl-install.png)
</Frame>

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

<Frame caption="WSL Ubuntu">
  ![WSL Ubuntu](/docs-assets/assets/docs/intro/installation/wsl-ubuntu-search.png)
</Frame>

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.

<Frame caption="Ubuntu Terminal">
  ![Ubuntu Terminal](/docs-assets/assets/docs/intro/installation/wsl-ubuntu-terminal-1.png)
</Frame>

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

<Frame caption="Windows Terminal">
  ![Windows Terminal](/docs-assets/assets/docs/intro/installation/wsl-windows-terminal.png)
</Frame>

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.

<Frame caption="Ubuntu Terminal">
  ![Ubuntu Terminal](/docs-assets/assets/docs/intro/installation/wsl-ubuntu-terminal-2.png)
</Frame>

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.

<Frame caption="WSL Setup in VS Code">
  ![WSL Setup in VS Code](/docs-assets/assets/docs/intro/installation/wsl-vscode.png)
</Frame>

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

<Frame caption="WSL: Ubuntu">
  ![WSL: Ubuntu](/docs-assets/assets/docs/intro/installation/wsl-vscode-ubuntu.png)
</Frame>

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

- Complete the [quick installation](/developers/docs/quickstart) 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

</Tab>
</Tabs>
</div>

<Steps titleSize="h3">
<Step title="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:

```bash Terminal
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
```

After a successful installation you will see the following message:

<AccordionGroup>
<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>
</AccordionGroup>

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

```bash Terminal
. "$HOME/.cargo/env"
```

3. Verify that the installation was successful.

```bash Terminal
rustc --version
```

The command prints the installed Rust version, for example:

```
rustc x.y.z (...)
```

</Step>
<Step title="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:

```bash Terminal
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
```

<Note>
  You can replace `stable` with a specific Agave release tag or with the `beta`
  or `edge` release channel.
</Note>

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

```bash Terminal
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:

```bash Terminal
echo $SHELL
```

- If the output contains `/bash`, restart the terminal or run
  `source ~/.bashrc`.
- If the output contains `/zsh`, restart the terminal or run `source ~/.zshrc`.

3. Verify that the installation succeeded:

```bash Terminal
solana --version
```

The command prints the installed Solana CLI version, for example:

```
solana-cli x.y.z (..., client:Agave)
```

<Note>

You can view all available versions on the
[Agave GitHub repository](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.

</Note>

4. To update the Solana CLI later, run:

```bash Terminal
agave-install update
```

</Step>
<Step title="Install Anchor CLI">

[Anchor](https://www.anchor-lang.com/) is a framework for developing Solana
programs. The Anchor framework uses Rust macros to simplify the process of
writing Solana programs.

#### Prerequisites

Node.js and npm, which ships with Node.js, are required only when you select a
TypeScript test template such as Mocha or Jest. Anchor uses pnpm or Yarn
instead when either is installed. The default LiteSVM test
template runs in Rust and does not require Node.js tooling.

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

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

```bash Terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
```

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

```bash Terminal
command -v nvm
```

3. Use `nvm` to install Node:

```bash Terminal
nvm install --lts
```

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

```bash Terminal
node --version
```

The command prints the installed Node.js version, for example:

```
vx.y.z
```

</Accordion>
</AccordionGroup>

#### 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>
<Tab title="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:

```bash Terminal
cargo install --git https://github.com/otter-sec/anchor avm --force
```

2.  Confirm that AVM installed successfully:

```bash Terminal
avm --version
```

3. Install Anchor CLI using AVM. These docs and the Quickstart installer use
   Anchor CLI 1.1.2:

```bash Terminal
avm install 1.1.2
avm use 1.1.2
```

To install the latest version instead:

```bash Terminal
avm install latest
avm use latest
```

When you run `anchor`, AVM also installs and activates the Solana CLI release
that matches the active Anchor version (Solana CLI 3.1.10 for Anchor 1.1.2),
and prints `3.1.10 initialized` when it switches.

<Warning>

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

</Warning>

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

```bash Terminal
anchor --version
```

The command prints the active Anchor CLI version, for example:

```
anchor-cli 1.1.2
```

<Info>

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`, run `avm use 1.1.2`.

</Info>

<Warning>

**`Error: canonicalizing AVM executable`?** If `anchor` fails with this error,
AVM's nightly channel is on. Anchor's `avm/install` shell script installs the
nightly AVM and turns the channel on. Turn it off, then select your version
again:

```bash Terminal
avm nightly --disable
avm use 1.1.2
```

</Warning>

</Tab>

<Tab title="Without AVM">

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

```bash Terminal
cargo install --git https://github.com/solana-foundation/anchor --tag v1.1.2 anchor-cli --locked
```

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

```bash Terminal
anchor --version
```

The command prints the installed Anchor CLI version, for example:

```
anchor-cli 1.1.2
```

<Note>

Without AVM, Anchor 1.1.2 runs with whichever Solana CLI is active. With
Solana CLI 4.3 or later, `anchor build` fails with
`Platform tools v1.52 is incompatible with SBPFv3`. See the workaround in
[Build your first program](/developers/docs/programs/build-first-program#run-test).

</Note>

</Tab>
</Tabs>

</Step>
<Step title="Install Surfpool CLI">

[Surfpool](/developers/docs/tools/surfpool) is a tool for local development and an improved
replacement for `solana-test-validator`.

1. Install Surfpool with the following command:

```bash Terminal
curl --proto '=https' --tlsv1.2 -sSfL https://run.surfpool.run/ | bash
```

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

```bash Terminal
surfpool --version
```

The command prints the installed Surfpool CLI version, for example:

```
surfpool x.y.z
```

</Step>
</Steps>
