BeginnerSetup

Development Environment Setup

Install all required tools and configure your Solana development environment.

Updated March 202512 min read

Prerequisites

Before setting up your Solana development environment, ensure your system meets the following requirements. Solana development is supported on macOS, Linux, and Windows (via WSL2). A modern machine with at least 8GB RAM is recommended for running a local validator.

Installing Rust

Solana programs are written in Rust. Install Rust using the official installer:

bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup component add rustfmt clippy

Installing the Solana CLI

The Solana CLI provides tools for deploying programs, managing wallets, and interacting with the network:

bash
# Install Solana CLI (latest stable)
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"

# Verify installation
solana --version

Installing Anchor Framework

Anchor is the most widely used framework for Solana program development. It abstracts away much of the boilerplate and provides safety checks:

bash
# Install Anchor Version Manager (AVM)
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force

# Install and use the latest Anchor version
avm install latest
avm use latest

# Verify
anchor --version

Setting Up a Wallet

bash
# Generate a new keypair
solana-keygen new --outfile ~/.config/solana/id.json

# Set the default keypair
solana config set --keypair ~/.config/solana/id.json

# Configure for devnet
solana config set --url devnet

# Request airdrop (devnet only)
solana airdrop 2

JavaScript/TypeScript Setup

bash
# Install Node.js (v18+ recommended)
# Using nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 20
nvm use 20

# Install Solana Web3.js
npm install @solana/web3.js

# Install Anchor client library
npm install @coral-xyz/anchor

Local Validator

For development, run a local Solana validator to test without network latency:

bash
# Start local test validator
solana-test-validator

# In another terminal, configure CLI to use localhost
solana config set --url localhost

# Check validator status
solana cluster-version
⚠️
The local validator resets its state every time it restarts. For persistent testing, use devnet or save snapshots with the --snapshot-interval-slots flag.

Visual Studio Code with the following extensions provides the best Solana development experience: rust-analyzer for Rust code intelligence, Solana Snippets for common patterns, and Even Better TOML for Cargo.toml files.