title |
---|
Install Sui to Build |
Learn how to install and configure Sui.
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 Sui binaries.
- Configure an Integrated Development Environment (IDE).
- Request SUI test tokens to use on Sui Devnet or Sui Testnet networks.
You can also download the source code to have local access to files.
The Sui repository includes primary branches, devnet
, testnet
, mainnet
, and main
.
- The
devnet
branch includes the latest stable build of Sui. Choose thedevnet
branch if you want to build or test on Sui Devnet. 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
testnet
branch includes the code running on the Sui Testnet network. - The
mainnet
branch includes the code running on the Sui Mainnet network. - 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 source for the documentation published on this site also resides in the Sui repository. The site displays the Mainnet version of the documentation by default. The content on the site differs between the branches of the repository just like the Sui source code. Use the version of the documentation that corresponds to the Sui network you plan to use. For example, to use the Sui Devnet network, use the Devnet version of the documentation. To use the Sui Testnet network, use the Testnet version of the documentation.
Sui supports the following operating systems:
- Linux - Ubuntu version 20.04 (Bionic Beaver)
- macOS - macOS Monterey
- Microsoft Windows - Windows 11
Install the following prerequisites and tools you need to work with Sui.
Prerequisite | Linux | macOS | Windows 11 |
---|---|---|---|
cURL | X | X | X |
Rust and Cargo | X | X | X |
Git CLI | X | X | X |
CMake | X | X | X |
GCC | X | ||
libssl-dev | X | ||
libclang-dev | X | ||
libpq-dev | X | ||
build-essential | X | ||
Brew | X | ||
C++ build tools | X | ||
LLVM Compiler | X |
Sui requires Rust and Cargo (Rust's package manager) on all supported operating systems. The suggested method to install Rust is with rustup
using cURL.
Some other commands in the installation instructions also require cURL to run. If you can't run the cURL command to install Rust, see the instructions to install cURL for your operating system before you install Rust.
Use the following command to install Rust and Cargo on macOS or Linux:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
If you use Windows 11, see information about using the Rust installer on the Rust website. The installer checks for C++ build tools and prompts you to install them if necessary. Select the option that best defines your environment and follow the instructions in the install wizard.
For additional installation options, see Install Rust.
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 with rustup
:
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. You might need to adjust the instructions to use other package managers.
Install the prerequisites listed in this section. 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.
Use the following command to install CMake.
sudo apt-get install cmake
To customize the installation, see Installing CMake on the CMake website.
Use the following command to install the GNU Compiler Collection, gcc
:
sudo apt-get install gcc
Use the following command to install libssl-dev
:
sudo apt-get install libssl-dev
If the version of Linux you use doesn't support libssl-dev
, find an equivalent package for it on the ROS Index.
(Optional) If you have OpenSSL you might also need to also install pkg-config
:
sudo apt-get install pkg-config
Use the following command to install libclang-dev
:
sudo apt-get install libclang-dev
If the version of Linux you use doesn't support libclang-dev
, find an equivalent package for it on the ROS Index.
Use the following command to install libpq-dev
:
sudo apt-get install libpq-dev
If the version of Linux you use doesn't support libpq-dev
, find an equivalent package for it on the ROS Index.
Use the following command to install build-essential
"
sudo apt-get install build-essential
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
To customize the installation, see Installing CMake on the CMake website.
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 is required to install Rust.
- The LLVM Compiler Infrastructure. Look for a file with a name similar to LLVM-15.0.7-win64.exe for 64-bit Windows, or LLVM-15.0.7-win32.exe for 32-bit Windows.
Known issue - The sui console
command does not work in PowerShell.
Run the following command to install Sui binaries from the devnet
branch:
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch devnet sui
The install process can take a while to complete. You can monitor installation progress in the terminal. If you encounter an error, make sure to install the latest version of all prerequisites and then try the command again.
To update to the latest stable version of Rust:
rustup update stable
The command installs Sui components in the ~/.cargo/bin
folder.
To confirm that Sui installed correctly, type sui
and press Enter. You should see a message about the Sui version installed and help for using Sui commands.
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-analyzer extension, then install the move-analyzer language server passing address32
using the --features
flag and passing sui-move
to the branch
flag:
cargo install --git https://github.com/move-language/move move-analyzer --branch sui-move --features "address32"
See more IDE options in the Awesome Move documentation.
You need SUI tokens to perform transactions on a Sui network. You can get test tokens from the Sui faucet in Discord, or directly in the Sui Wallet.
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:shell !faucet 0xa56612ad4f5dbc04c651e8d20f56af3316ee6793335707f29857bacabf9127d0
A bot on the channel distributes tokens to your address.
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 - Sui, including the Sui CLI Client
- sui_programmability - Sui Move code examples (games, defi, nfts, ...)
- sui_core - Core Sui components
- sui-types - Sui object types, such as coins and gas
- explorer - browser-based object explorer for the Sui network
- sui-network - networking interfaces