2020-07-10 22:11:07 -07:00
|
|
|
---
|
2023-12-11 12:17:13 -08:00
|
|
|
title: Install the Solana CLI
|
|
|
|
sidebar_label: Installation
|
|
|
|
sidebar_position: 1
|
2020-07-10 22:11:07 -07:00
|
|
|
---
|
2019-08-08 10:42:17 -07:00
|
|
|
|
2023-12-19 11:50:50 -08:00
|
|
|
There are multiple ways to install the Solana tools on your computer depending
|
|
|
|
on your preferred workflow:
|
2020-07-10 22:11:07 -07:00
|
|
|
|
|
|
|
- [Use Solana's Install Tool (Simplest option)](#use-solanas-install-tool)
|
|
|
|
- [Download Prebuilt Binaries](#download-prebuilt-binaries)
|
|
|
|
- [Build from Source](#build-from-source)
|
2022-05-02 10:06:28 -07:00
|
|
|
- [Use Homebrew](#use-homebrew)
|
2020-04-02 14:36:02 -07:00
|
|
|
|
|
|
|
## Use Solana's Install Tool
|
|
|
|
|
|
|
|
### MacOS & Linux
|
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- Open your favorite Terminal application
|
2020-04-02 14:36:02 -07:00
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- Install the Solana release
|
2023-12-19 11:50:50 -08:00
|
|
|
[LATEST_SOLANA_RELEASE_VERSION](https://github.com/solana-labs/solana/releases/tag/LATEST_SOLANA_RELEASE_VERSION)
|
|
|
|
on your machine by running:
|
2019-08-08 10:42:17 -07:00
|
|
|
|
|
|
|
```bash
|
2020-10-23 13:57:47 -07:00
|
|
|
sh -c "$(curl -sSfL https://release.solana.com/LATEST_SOLANA_RELEASE_VERSION/install)"
|
2019-08-08 10:42:17 -07:00
|
|
|
```
|
|
|
|
|
2020-10-23 13:57:47 -07:00
|
|
|
- You can replace `LATEST_SOLANA_RELEASE_VERSION` with the release tag matching
|
|
|
|
the software version of your desired release, or use one of the three symbolic
|
|
|
|
channel names: `stable`, `beta`, or `edge`.
|
2019-12-06 13:07:41 -08:00
|
|
|
|
2020-04-02 14:36:02 -07:00
|
|
|
- The following output indicates a successful update:
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-11-28 14:39:27 -08:00
|
|
|
```text
|
2020-03-12 08:36:19 -07:00
|
|
|
downloading LATEST_SOLANA_RELEASE_VERSION installer
|
2019-11-28 14:39:27 -08:00
|
|
|
Configuration: /home/solana/.config/solana/install/config.yml
|
|
|
|
Active release directory: /home/solana/.local/share/solana/install/active_release
|
2020-03-12 08:36:19 -07:00
|
|
|
* Release version: LATEST_SOLANA_RELEASE_VERSION
|
|
|
|
* Release URL: https://github.com/solana-labs/solana/releases/download/LATEST_SOLANA_RELEASE_VERSION/solana-release-x86_64-unknown-linux-gnu.tar.bz2
|
2019-11-28 14:39:27 -08:00
|
|
|
Update successful
|
2019-08-08 10:42:17 -07:00
|
|
|
```
|
|
|
|
|
2023-12-19 11:50:50 -08:00
|
|
|
- Depending on your system, the end of the installer messaging may prompt you to
|
2020-07-10 22:11:07 -07:00
|
|
|
|
|
|
|
```bash
|
2020-04-02 14:36:02 -07:00
|
|
|
Please update your PATH environment variable to include the solana programs:
|
|
|
|
```
|
2020-07-10 22:11:07 -07:00
|
|
|
|
2023-12-19 11:50:50 -08:00
|
|
|
- If you get the above message, copy and paste the recommended command below it
|
|
|
|
to update `PATH`
|
2020-07-10 22:11:07 -07:00
|
|
|
- Confirm you have the desired version of `solana` installed by running:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
solana --version
|
2020-04-02 14:36:02 -07:00
|
|
|
```
|
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- After a successful install, `solana-install update` may be used to easily
|
|
|
|
update the Solana software to a newer version at any time.
|
2020-04-02 14:36:02 -07:00
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
---
|
2020-04-02 14:36:02 -07:00
|
|
|
|
2020-07-25 22:47:37 -07:00
|
|
|
### Windows
|
2020-04-02 14:36:02 -07:00
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- Open a Command Prompt (`cmd.exe`) as an Administrator
|
|
|
|
|
2023-12-19 11:50:50 -08:00
|
|
|
- Search for Command Prompt in the Windows search bar. When the Command Prompt
|
|
|
|
app appears, right-click and select “Open as Administrator”. If you are
|
|
|
|
prompted by a pop-up window asking “Do you want to allow this app to make
|
|
|
|
changes to your device?”, click Yes.
|
2020-04-02 14:36:02 -07:00
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- Copy and paste the following command, then press Enter to download the Solana
|
|
|
|
installer into a temporary directory:
|
2020-04-02 14:36:02 -07:00
|
|
|
|
|
|
|
```bash
|
2022-10-06 03:38:48 -07:00
|
|
|
cmd /c "curl https://release.solana.com/LATEST_SOLANA_RELEASE_VERSION/solana-install-init-x86_64-pc-windows-msvc.exe --output C:\solana-install-tmp\solana-install-init.exe --create-dirs"
|
2020-04-02 14:36:02 -07:00
|
|
|
```
|
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- Copy and paste the following command, then press Enter to install the latest
|
|
|
|
version of Solana. If you see a security pop-up by your system, please select
|
|
|
|
to allow the program to run.
|
2020-04-02 14:36:02 -07:00
|
|
|
|
|
|
|
```bash
|
|
|
|
C:\solana-install-tmp\solana-install-init.exe LATEST_SOLANA_RELEASE_VERSION
|
|
|
|
```
|
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- When the installer is finished, press Enter.
|
|
|
|
|
|
|
|
- Close the command prompt window and re-open a new command prompt window as a
|
|
|
|
normal user
|
|
|
|
- Search for "Command Prompt" in the search bar, then left click on the
|
|
|
|
Command Prompt app icon, no need to run as Administrator)
|
|
|
|
- Confirm you have the desired version of `solana` installed by entering:
|
2020-04-02 14:36:02 -07:00
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
```bash
|
|
|
|
solana --version
|
2020-04-02 14:36:02 -07:00
|
|
|
```
|
|
|
|
|
2020-07-10 22:11:07 -07:00
|
|
|
- After a successful install, `solana-install update` may be used to easily
|
|
|
|
update the Solana software to a newer version at any time.
|
2019-08-08 10:42:17 -07:00
|
|
|
|
|
|
|
## Download Prebuilt Binaries
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-12-02 09:53:07 -08:00
|
|
|
If you would rather not use `solana-install` to manage the install, you can
|
|
|
|
manually download and install the binaries.
|
2019-08-08 10:42:17 -07:00
|
|
|
|
|
|
|
### Linux
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-12-02 09:53:07 -08:00
|
|
|
Download the binaries by navigating to
|
|
|
|
[https://github.com/solana-labs/solana/releases/latest](https://github.com/solana-labs/solana/releases/latest),
|
2023-04-06 09:27:25 -07:00
|
|
|
download **solana-release-x86_64-unknown-linux-gnu.tar.bz2**, then extract the
|
2019-12-02 09:53:07 -08:00
|
|
|
archive:
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-08-08 10:42:17 -07:00
|
|
|
```bash
|
2019-10-29 16:13:20 -07:00
|
|
|
tar jxf solana-release-x86_64-unknown-linux-gnu.tar.bz2
|
|
|
|
cd solana-release/
|
|
|
|
export PATH=$PWD/bin:$PATH
|
2019-08-08 10:42:17 -07:00
|
|
|
```
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2020-04-02 14:36:02 -07:00
|
|
|
### MacOS
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-12-02 09:53:07 -08:00
|
|
|
Download the binaries by navigating to
|
|
|
|
[https://github.com/solana-labs/solana/releases/latest](https://github.com/solana-labs/solana/releases/latest),
|
2020-07-10 22:11:07 -07:00
|
|
|
download **solana-release-x86_64-apple-darwin.tar.bz2**, then extract the
|
2019-12-02 09:53:07 -08:00
|
|
|
archive:
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-08-08 10:42:17 -07:00
|
|
|
```bash
|
2019-10-29 16:13:20 -07:00
|
|
|
tar jxf solana-release-x86_64-apple-darwin.tar.bz2
|
|
|
|
cd solana-release/
|
|
|
|
export PATH=$PWD/bin:$PATH
|
2019-08-08 10:42:17 -07:00
|
|
|
```
|
|
|
|
|
2020-04-02 14:36:02 -07:00
|
|
|
### Windows
|
|
|
|
|
|
|
|
- Download the binaries by navigating to
|
2020-07-10 22:11:07 -07:00
|
|
|
[https://github.com/solana-labs/solana/releases/latest](https://github.com/solana-labs/solana/releases/latest),
|
2020-07-24 22:01:14 -07:00
|
|
|
download **solana-release-x86_64-pc-windows-msvc.tar.bz2**, then extract the
|
2020-07-10 22:11:07 -07:00
|
|
|
archive using WinZip or similar.
|
2020-04-02 14:36:02 -07:00
|
|
|
|
|
|
|
- Open a Command Prompt and navigate to the directory into which you extracted
|
2020-07-10 22:11:07 -07:00
|
|
|
the binaries and run:
|
2020-04-02 14:36:02 -07:00
|
|
|
|
|
|
|
```bash
|
|
|
|
cd solana-release/
|
|
|
|
set PATH=%cd%/bin;%PATH%
|
|
|
|
```
|
|
|
|
|
2019-08-08 10:42:17 -07:00
|
|
|
## Build From Source
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-12-02 09:53:07 -08:00
|
|
|
If you are unable to use the prebuilt binaries or prefer to build it yourself
|
2023-12-19 11:50:50 -08:00
|
|
|
from source, follow these steps, ensuring you have the necessary prerequisites
|
|
|
|
installed on your system.
|
|
|
|
|
|
|
|
### Prerequisites
|
|
|
|
|
|
|
|
Before building from source, make sure to install the following prerequisites:
|
|
|
|
|
|
|
|
#### For Debian and Other Linux Distributions:
|
|
|
|
|
|
|
|
Rust Programming Language: Check "Install Rust" at
|
|
|
|
[https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install),
|
|
|
|
which recommends the following command.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
```
|
|
|
|
|
|
|
|
Install build dependencies:
|
|
|
|
|
|
|
|
- Build essential
|
|
|
|
- Package config
|
|
|
|
- Udev & LLM & libclang
|
|
|
|
- Protocol buffers
|
|
|
|
|
|
|
|
```bash
|
|
|
|
apt-get install \
|
|
|
|
build-essential \
|
|
|
|
pkg-config \
|
|
|
|
libudev-dev llvm libclang-dev \
|
|
|
|
protobuf-compiler
|
|
|
|
```
|
|
|
|
|
|
|
|
#### For Other Linux Distributions:
|
|
|
|
|
|
|
|
Replace `apt` with your distribution's package manager (e.g., `yum`, `dnf`,
|
|
|
|
`pacman`) and adjust package names as needed.
|
|
|
|
|
|
|
|
#### For macOS:
|
|
|
|
|
|
|
|
Install Homebrew (if not already installed), check "Install Hombrew" at
|
|
|
|
[https://brew.sh/](https://brew.sh/), which recommends the following command:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
|
|
```
|
|
|
|
|
|
|
|
Install the necessary tools and libraries using Homebrew:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
brew install rust pkg-config libudev protobuf llvm coreutils
|
|
|
|
```
|
|
|
|
|
|
|
|
Follow the instructions given at the end of the brew install command about
|
|
|
|
`PATH` configurations.
|
|
|
|
|
|
|
|
#### For Windows:
|
|
|
|
|
|
|
|
Rust Programming Language: Check "Install Rust" at
|
|
|
|
[https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install),
|
|
|
|
which recommends the following command.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
```
|
|
|
|
|
|
|
|
- Download and install the Build Tools for Visual Studio (2019 or later) from
|
|
|
|
the
|
|
|
|
[Visual Studio downloads page](https://visualstudio.microsoft.com/downloads/).
|
|
|
|
Make sure to include the C++ build tools in the installation.
|
|
|
|
- Install LLVM: Download and install LLVM from the
|
|
|
|
[official LLVM download page](https://releases.llvm.org/download.html).
|
|
|
|
- Install Protocol Buffers Compiler (protoc): Download `protoc` from the
|
|
|
|
[GitHub releases page of Protocol Buffers](https://github.com/protocolbuffers/protobuf/releases),
|
|
|
|
and add it to your `PATH`.
|
|
|
|
|
|
|
|
:::info
|
|
|
|
|
|
|
|
Users on Windows 10 or 11 may need to install
|
|
|
|
[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install)
|
|
|
|
(WSL) in order to be able to build from source. WSL provides a Linux environment
|
|
|
|
that runs inside your existing Windows installation. You can then run regular
|
|
|
|
Linux software, including the Linux versions of Solana CLI.
|
|
|
|
|
|
|
|
After installed, run `wsl` from your Windows terminal, then continue through the
|
|
|
|
[Debian and Other Linux Distributions](#for-debian-and-other-linux-distributions)
|
|
|
|
above.
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
### Building from Source
|
|
|
|
|
|
|
|
After installing the prerequisites, proceed with building Solana from source,
|
|
|
|
navigate to
|
|
|
|
[Solana's GitHub releases page](https://github.com/solana-labs/solana/releases/latest),
|
2019-12-02 09:53:07 -08:00
|
|
|
and download the **Source Code** archive. Extract the code and build the
|
|
|
|
binaries with:
|
2019-09-22 20:38:34 -07:00
|
|
|
|
2019-08-08 10:42:17 -07:00
|
|
|
```bash
|
2019-10-29 16:13:20 -07:00
|
|
|
./scripts/cargo-install-all.sh .
|
|
|
|
export PATH=$PWD/bin:$PATH
|
2019-08-08 10:42:17 -07:00
|
|
|
```
|
2019-11-28 14:39:27 -08:00
|
|
|
|
2019-12-02 09:53:07 -08:00
|
|
|
You can then run the following command to obtain the same result as with
|
|
|
|
prebuilt binaries:
|
2019-11-28 14:39:27 -08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
solana-install init
|
|
|
|
```
|
2022-05-02 10:06:28 -07:00
|
|
|
|
|
|
|
## Use Homebrew
|
|
|
|
|
2023-12-19 11:50:50 -08:00
|
|
|
This option requires you to have [Homebrew](https://brew.sh/) package manager on
|
|
|
|
your MacOS or Linux machine.
|
2022-05-02 10:06:28 -07:00
|
|
|
|
|
|
|
### MacOS & Linux
|
|
|
|
|
|
|
|
- Follow instructions at: https://formulae.brew.sh/formula/solana
|
|
|
|
|
|
|
|
[Homebrew formulae](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/solana.rb)
|
2023-12-19 11:50:50 -08:00
|
|
|
is updated after each `solana` release, however it is possible that the Homebrew
|
|
|
|
version is outdated.
|
2022-05-02 10:06:28 -07:00
|
|
|
|
|
|
|
- Confirm you have the desired version of `solana` installed by entering:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
solana --version
|
|
|
|
```
|