Skip to main content

Installation

To install, either download a binary, install from Crates.io, or install from source. Non-technical users will typically find using a pre-built binary to be simpler.

info

When installing from crates.io or from source on Ubuntu or WSL (Windows Subsystem for Linux) you may need to install some additional dependencies:

sudo apt install libudev-dev pkg-config unzip

Binaries

Binaries for the supported OS can be found at:

Run this install script in your terminal:

bash <(curl -sSf https://sugar.metaplex.com/install.sh)

This will install the binary to your machine and add it to your PATH.

caution

The modifications to your PATH variable may not take effect until the terminal is restarted. Follow the instructions of the installation script to see whether the terminal needs to be restarted or not.

Advanced Installation Methods

Crates.io

In order to install sugar from Crates.io, you will need to have Rust installed in your system. It is recommended to install Rust using rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

After the installation completes, running:

rustc --version

should print the version of the Rust compiler. If the command fails, check if the ~/.cargo/bin directory is in your PATH environment variable.

The next step is to install Sugar from Crates.io:

cargo install sugar-cli --locked

This will download the Sugar code from Crates.io and automatically install it for you.

Build From Source

In order to build Sugar from the source code, you will need to have Rust installed in your system. It is recommended to install Rust using rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

After the installation completes, running:

rustc --version

should print the version of the Rust compiler. If the command fails, check if the ~/.cargo/bin directory is in your PATH environment variable.

The next step is to clone Sugar repository:

git clone https://github.com/metaplex-foundation/sugar.git

This will create a directory sugar with the latest code from the repository. Switch to the newly created directory:

cd sugar

Then, you can build and install the binary to ~/.cargo/bin:

cargo install --locked --path ./

As long as ./cargo/bin is in your PATH environment variable, you will be able to execute sugar from any directory in your file system.

Note: You need to execute cargo install from Sugar source code root directory the directory where the Cargo.toml is located.