title |
---|
Install Sui to Build |
Learn how to install and configure Sui to develop smart contracts on the Sui blockchain.
Before you install Sui, you need to install some prerequisite tools and configure your development environment.
The steps to install Sui include:
- Install prerequisites for your operating system.
- Install the 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 repository 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
branch includes the most recent changes and updates. Use themain
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.
The main
and devnet
branches of the Sui repository contain the relevant documentation for each branch. A version toggle on the documentation site enables you to switch between main
branch content (labeled Latest build) and devnet
branch content (labeled Devnet). Make sure the toggle is set to Devnet for to learn how to install, configure, and build on Sui. The content in Latest build is useful to learn about potential updates to Sui, but the features and functionality described might not ever become available in the devnet
branch.
Sui supports the following operating systems, beginning with the versions indicated.
- Linux - Ubuntu version 20.04 (Bionic Beaver)
- macOS - macOS Monterey
- Microsoft Windows - Windows 11
Install the prerequisites and tools you need to work with Sui. Click a marker in the table to jump to the relevant section.
Package/OS | Linux | macOS | Windows 11 |
---|---|---|---|
cURL | X | X | X |
Rust and Cargo | 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. Some operating systems require cURL to download Rust and Cargo, so check the relevant prerequisite section to install cURL first, if necessary.
Use the following command to install Rust and Cargo on macOS or Linux:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Windows 11 users can use the Rust installer available on the Rust website. The installer detects if you do not have the required C++ build tools and prompts you to install. Select the option that best defines your environment and follow the instructions in the install wizard.
For additional installation options, see Install Rust on the Rust website.
Sui uses the latest version of Cargo to build and manage dependencies. See the Cargo installation page on the Rust website 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.
Note: The Linux instructions assume a distribution that uses the APT package manager. Adapt the instructions as needed for other package managers.
Install the prerequisites listed in this section. You should make sure that your system has the latest version of apt-get
. Use the following command to update apt-get
:
$ 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 on the GitHub website.
Install CMake using the instructions at Installing CMake on the CMake website.
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 you can use to install Brew. 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 update the default cURL on macOS:
$ brew install curl
Use the following command to install CMake:
$ brew install cmake
Use the following command to install Git:
$ brew install git
After installing Git, download and install the Git command line interface.
Proceed to Install Sui binaries to continue installing Sui.
Install the following prerequisites to work with Sui on Microsoft Windows 11.
Windows 11 ships with a Microsoft version of cURL already installed. If you want to use the curl project version instead, download and install it from https://curl.se/windows/.
Download and install the Git command line interface.
Download and install CMake from the CMake website.
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 are required to install Rust, so you should already have these installed if you followed these instructions.
- 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 to fix the issue.
Known issue: The
sui console
command does not work in PowerShell.
With Cargo installed, use the following command to install Sui binaries:
$ cargo install --locked --git https://github.com/MystenLabs/sui.git --branch devnet sui
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.
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 .cargo/bin
appearing in your PATH variable:
$ echo $PATH
Confirm the binaries are installed with .cargo\bin
appearing in your PATH variable:
$ echo %PATH%
Use the --help
flag to access helpful information for any of these binaries.
Important: Make sure your entire toolchain stays up-to-date. If you encounter issues building and installing the Sui binaries, update all packages and re-install.
The recommended IDE for Move development is Visual Studio Code with the move-analyzer extension. Follow the Visual Studio Marketplace instructions to install the move-nalyzer extension, passing address20
using the --features
flag:
$ cargo install --git https://github.com/move-language/move move-analyzer --features "address20"
See more IDE options in the Awesome Move documentation.
To experiment with Devnet or use the Sui Wallet browser extension, add SUI tokens to your account address.
To request SUI test tokens from the browser extension:
- Use the Sui Wallet browser extension to open your wallet.
- Click the Request Sui Devnet SUI Tokens button.
To request SUI test tokens in Discord:
- 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 repository on GitHub: https://github.com/MystenLabs/sui
Clone the Sui repository:
$ git clone https://github.com/MystenLabs/sui.git --branch devnet
The following primary directories offer a good starting point for exploring Sui's source code:
- 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 previous
git clone
command syncs with thedevnet
branch, which makes sure the source code is compatible with our Devnet. If you want to run a network locally using the latest version and don't need to interact with our Devnet, you should switch tomain
branch.
Continue your journey through: