title |
---|
Install Sui to Build |
Learn how to install and configure Sui.
Before you install Sui, you need to install some prerequisite tools and then configure your environment.
The steps to install Sui include:
- Install prerequisites
- Install Sui binaries
- Configure an Integrated Development Environment (IDE)
- Request SUI tokens to evaluate Devnet and Sui Wallet
- Optionally, download the source code to have local access to examples and contribute to Sui.
The Sui repo includes two primary branches, devnet
and main
.
- The
devnet
branch includes the latest stable build of Sui. Choose thedevnet
branch if you want to build or test on Sui. If you encounter an issue or find a bug, it may already be fixed in themain
branch. To submit a Pull Request (PR), you should push commits to your fork of themain
branch. - The
main
(Latest build) branch includes the most recent changes and updates. Use themain
(Latest build) branch if you want to contribute to the Sui project. Themain
branch may include unreleased changes, or introduce changes that cause issues in apps created using an earlier version.
This documentation is built from the same branches, main
and devnet
. The main
branch includes the latest additions and updates to the documentation. You can view the content to learn about upcoming updates to the documentation, but the information may not be accurate or up-to-date for the features and functionality available in the devnet
branch. In most cases, you should view the devnet
version of the documentation.
To change branches, choose Latest build to view the documentation generated from the main
branch of the repository. You should not use the Latest build version to learn how to install, configure, or build on Sui, as the information may change before the content is merged to Devnet.
Sui supports the following operating systems.
- Linux - Ubuntu version 18.04 (Bionic Beaver)
- macOS - macOS Monterey
- Microsoft Windows - Windows 11
Install the prerequisites and tools you need to work with Sui.
Package/OS | Linux | macOS | Windows 11 |
---|---|---|---|
Curl | X | X | X |
Rust | X | X | X |
Git CLI | X | X | X |
CMake | X | X | X |
libssl-dev | X | ||
libclang-dev | X | ||
Brew | X | ||
C++ build tools | X | ||
LLVM Compiler | X |
Sui requires Rust and Cargo on all supported operating systems.
Use the following command to install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
For additional installation options, see Install Rust.
The rustup
script also installs Cargo.
Sui uses the latest version of Cargo to build and manage dependencies. See the Cargo installation page for more information.
Use the following command to update Rust:
$ rustup update stable
After you install Rust, proceed to the prerequisites for your operating system.
Install the prerequisites listed in this section. You should make sure that your system has the latest version of apt
. Use the following command to update it:
sudo apt-get update
Install cURL with the following command:
sudo apt install curl
Verify that cURL installed correctly with the following command:
curl --version
Run the following command to install Git, including the Git CLI:
sudo apt-get install git-all
For more information, see Install Git on Linux
Install CMake with the following commands:
./bootstrap
make
make install
For more information, see Install CMake
use the following command to install libssl-dev
:
sudo apt-get install libssl-dev
use the following command to install libclang-dev
:
sudo apt-get install libclang-dev
Proceed to Install Sui binaries to continue installing Sui.
macOS includes a version of cURL. Use cURL to install Brew, and then use Brew to install other tools, including a newer version of cURL.
Use the following command to install Brew:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Use the following command to install cURL:
brew install curl
Use the following command to install CMake:
brew install cmake
Use the following command to install Git:
brew install git
You can also Download and install the Git command line interface for your operating system.
Proceed to Install Sui binaries to continue installing Sui.
Install the prerequisites listed in the following section if to work with Sui on Microsoft Windows.
Download and install cURL from https://curl.se/windows/.
Download and install the Git command line interface for your operating system.
Download and install CMake from: https://cmake.org/download/
Download Protocol Buffers (protoc-xx.x-win32.zip or protoc-xx.x-win64.zip) and add the \bin directory to your Windows PATH environment variable.
Sui requires the following additional tools on computers running Windows.
- For Windows on ARM64 only - Visual Studio 2022 Preview
- C++ build tools
- The LLVM Compiler Infrastructure
Tip: The installation progress might appear hanging if the
cmd.exe
window loses focus; press theenter
key in the command prompt fix the issue.
Known Issue: The
sui console
command does not work in PowerShell.
After you install Cargo, use the following command to install Sui binaries:
$ cargo install --locked --git https://github.com/MystenLabs/sui.git --branch devnet sui sui-node
The command installs the following Sui components in ~/.cargo/bin
:
sui
- The Sui CLI tool contains subcommands for enablinggenesis
of validators and accounts, starting the Sui network, and building and testing Move packages, as well as a client for interacting with the Sui network.Sui node
- installs the Sui node binary.
Trouble shooting: If the previous command fails, make sure you have the latest version of Rust installed:
rustup update stable
source "$HOME/.cargo/env"
Confirm the binaries are installed with:
$ echo $PATH
Confirm the binaries are installed with:
$ echo %PATH%
And ensure the .cargo/bin
directory appears. Access the help for any of these binaries by passing the --help
argument to it.
Important: Make sure your entire toolchain stays up-to-date. If you encounter issues building and installing the Sui binaries, update all packages above and re-install.
For Move development, we recommend the Visual Studio Code IDE with the Move Analyzer language server plugin installed:
$ cargo install --git https://github.com/move-language/move move-analyzer --features "address20"
Then follow the Visual Studio Marketplace instructions to install the Move Analyzer extension. (The cargo install
command for the language server is broken there; hence, we include the correct command above.)
See more IDE options in the Awesome Move docs.
To experiment with Devnet or use the Sui Wallet Browser Extension, you can add SUI tokens to your account address.
To request SUI test tokens:
- Join the Sui Discord If you haven’t already.
- Identify your address through either the Sui Wallet Browser Extension or by running the following command and electing to connect to a Sui RPC server if prompted:
$ sui client active-address
- Request tokens in the #devnet-faucet channel using the syntax:
!faucet <YOUR_ADDRESS>
, for example:!faucet 0xd72c2c90ed9d923cb0ed2ca91db5be9e1c9b5ccb
- A bot on the channel distributes tokens to you automatically.
View the Sui repo on GitHub: https://github.com/MystenLabs/sui
Clone the Sui repository:
$ git clone https://github.com/MystenLabs/sui.git --branch devnet
You can start exploring Sui's source code by looking into the following primary directories:
- sui - the Sui CLI binary
- sui_programmability - Sui's Move language integration also including games and other Move code examples for testing and reuse
- sui_core - authority server and Sui Gateway
- sui-types - coins, gas, and other object types
- explorer - object explorer for the Sui network
- sui-network - networking interfaces
See the Rust Crates in use at:
- https://mystenlabs.github.io/sui/ - the Sui blockchain
- https://mystenlabs.github.io/narwhal/ - the Narwhal and Bullshark consensus engine
- https://mystenlabs.github.io/mysten-infra/ - Mysten Labs infrastructure
To contribute updates to Sui code, send pull requests our way.
NOTE: the above
git clone
command syncs with thedevnet
branch, which makes sure the source code is compatible with our Devnet. If you want to run network locally using the latest version and don't need to interact with our Devnet, you should switch tomain
branch.
Continue your journey through: