Discover how to install the Solana CLI and configure your environment for Solana development with this easy-to-follow guide.
Hey there, fellow crypto adventurer! Ready to dive into the world of Solana development? Whether you’re just starting out or you’re a seasoned dev looking to expand your toolkit, setting up the Solana Command Line Interface (CLI) is your gateway to the Solana ecosystem.
Let’s walk through the process together, with a little code magic and some handy tips along the way.
Before we jump into the setup, let’s take a moment to understand what the Solana CLI is and why it’s such a crucial tool for developers in the Solana ecosystem.
The Solana Command Line Interface (CLI) is a powerful toolset that allows you to interact directly with the Solana blockchain from your terminal. Whether you're managing wallets, deploying smart contracts (called programs in Solana), or querying the state of the blockchain, the CLI provides you with the commands needed to perform these tasks efficiently.
Here’s what you can do with the Solana CLI:
In short, the Solana CLI is your command center for all things Solana, enabling you to harness the full potential of the blockchain from a simple terminal interface. Now that we know what it is, let’s get started with setting it up!
Before we get our hands dirty with Solana, let’s make sure our environment is prepped and ready. Depending on your operating system, the installation process can vary a bit, but don’t worry—we’ve got you covered.
If you’re on Windows, you’ll need to install the Windows Subsystem for Linux (WSL). This essentially gives you a Linux environment within your Windows OS, making the rest of the setup process much smoother. Follow the official WSL installation guide from Microsoft, and once you’re done, you can skip ahead to the Linux section.
Linux users, you’re in luck! Most of the heavy lifting is already done. You just need to ensure a few dependencies are installed:
1sudo apt-get update
2sudo apt-get install -y curl build-essential pkg-config libudev-dev llvm libclang-dev protobuf-compiler
3
4
Mac users, your journey begins with installing Rust. But first, let’s get Homebrew (if you haven’t already):
1/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
2
3
Once Homebrew is up and running, install the necessary dependencies:
1brew install rust pkg-config libudev protobuf llvm coreutils
2
3
Solana programs are written in Rust, so getting Rust set up is the next step. Rust’s installation is a breeze thanks to rustup
, the recommended installation method.
Open your terminal and run:
1curl --proto '=https' --tlsv1.2 -sSf <https://sh.rustup.rs> | sh -s -- -y
2
3
After a successful installation, reload your environment to include Cargo’s bin directory in your PATH:
1source $HOME/.cargo/env
2
3
To confirm Rust is good to go, check the installed version:
1rustc --version
2
3
You should see something like:
1rustc 1.80.1 (3f5fd8dd4 2024-09-02)
2
3
With Rust in place, it’s time to bring the Solana CLI into the spotlight. The CLI is packed with tools to build, deploy, and manage Solana programs.
Run this command to install the Solana CLI:
1sh -c "$(curl -sSfL <https://release.anza.xyz/stable/install>)"
2
3
For first-time installations, you might get a prompt to add the Solana CLI to your PATH. If you do, simply follow the instructions:
1export PATH="/Users/yourusername/.local/share/solana/install/active_release/bin:$PATH"
2
3
And verify the installation:
1solana --version
2
3
You should see output like:
1solana-cli 1.18.22 (src:9efdd74b; feat:4215500110, client:Agave)
2
3
Anchor simplifies Solana program development with its powerful framework. Let’s install it:
1cargo install --git <https://github.com/coral-xyz/anchor> --tag v0.30.1 anchor-cli
2
3
To confirm that Anchor CLI is installed correctly:
1anchor --version
2
3
You should see:
1anchor-cli 0.30.1
2
3
For running Anchor’s default test files (especially if you’re diving into TypeScript), you’ll need Node.js and Yarn.
Linux/Mac Users can install Node.js and Yarn via Homebrew:
1brew install node
2brew install yarn
3
4
With the Solana CLI installed, let’s familiarize ourselves with some basic commands.
To view your current configuration:
1solana config get
2
Expect output like this:
1Config File: /Users/test/.config/solana/cli/config.yml
2RPC URL: <https://api.mainnet-beta.solana.com>
3WebSocket URL: wss://api.mainnet-beta.solana.com/ (computed)
4Keypair Path: /Users/test/.config/solana/id.json
5Commitment: confirmed
6
7
You can set the cluster to work on different networks:
1solana config set --url devnet
2
3
Other clusters include:
1solana config set --url mainnet-beta
2solana config set --url localhost
3solana config set --url testnet
4
5
Let’s create a wallet to interact with the Solana network:
1solana-keygen new
2
3
Keep your seed phrase safe, and once generated, view your wallet’s public key:
1solana address
2
3
To fund your wallet with some SOL on the devnet:
1solana config set -ud
2solana airdrop 2
3
4
Check your balance:
1solana balance
2
3
For local testing, start a Solana validator:
1solana-test-validator
2
3
Don’t forget to set your CLI config to localhost:
1solana config set -ul
2
3
And that’s it! You’ve successfully installed the Solana CLI and set up your environment for Solana development. Now, whether you’re planning to deploy the next big dApp or just want to explore Solana’s blockchain, you’re equipped with all the tools you need. Happy coding!
But before you wrap things up and get ready to deploy something cool on Solana Mainnet, there’s one crucial step you shouldn’t skip—security!
Join 1400+ leaders who secured themselves from losing Billion Dollars.
Make sure to get your project audited by a reliable firm like QuillAudits, known for thorough and reliable blockchain security services. If you’re looking for a faster, AI-driven option, consider using QuillShield, an AI agent that not only finds vulnerabilities but also solves them.
And the best part? You can get an AI audit from QuillShield for free! Stay safe and secure as you launch your next big project.
Contents
Get updates on our community, partners, events, and everything happening across the ecosystem — delivered straight to your inbox.
Subscribe Now!
Office 104/105 Level 1, Emaar Square, Building 4 Sheikh Mohammed Bin Rashid Boulevard Downtown Dubai, United Arab Emirates P.O box: 416654
Privacy PolicyAll Rights Reserved. © 2025. QuillAudits - LLC
Office 104/105 Level 1, Emaar Square, Building 4 Sheikh Mohammed Bin Rashid Boulevard Downtown Dubai, United Arab Emirates P.O box: 416654
audits@quillaudits.comAll Rights Reserved. © 2025. QuillAudits - LLC
Privacy Policy