Prerequisites
Before we begin let’s make sure your local environment is setup with the proper prerequisites.
Node Environment
- node.js (v18.16.0+) (download (opens in a new tab))
- pnpm (after installing node:
npm install --global pnpm
)
If you are using Windows:
Windows steps
- install git bash (gitforwindows.org)
- install
nodejs
, including “native modules” (nodejs.org/en/download) (re native modules: just keep the checkmark, it’s enabled by default in the installer)
Sui Binaries
There are two main approaches for obtaining Sui:
-
Installation:
-
If you are running on a Unix machine (Linux/macOS), then the simplest option is to download the latest binary.
-
You can also install via Cargo.
-
-
Alternatively, build Sui directly from source.
Download or compile the Sui binaries and configure them in the global environment, our CLI will use
sui
andsui-test-validator
.
(Method 1) Install by downloading
Simply head to the GitHub Releases (opens in a new tab) page and download the latest version of Sui binary matching your platform:
- macOS arm64: sui-RELEASE_VERSION-macos-arm64.tgz
- macOS x86: sui-RELEASE_VERSION-macos-x86_64.tgz
- Linux: sui-RELEASE_VERSION-ubuntu-x86_64.tgz
- Windows: sui-RELEASE_VERSION-windows-x86_64.tgz
If you are using macOS/Linux:
The step-by-step instruction below should carry you through the whole process:
-
Make the directory where we'll place the binary:
mkdir -p $HOME/.sui/bin
-
Extract the binary archive:
tar -C $HOME/.sui -vxzf $ARCHIVE_NAME && mv $HOME/.sui/target/release/* $HOME/.sui/bin && rm -rf $HOME/.sui/target
-
Rename binary:
# sui-test-validator-($platform) for example: sui-test-validator-macos-arm64; sui-($platform) for example: sui-macos-arm64 mv $HOME/.sui/bin/sui-test-validator-($platform) $HOME/.sui/bin/sui-test-validator && mv $HOME/.sui/bin/sui-($platform) $HOME/.sui/bin/sui
-
Update your path, by adding this line in your .bashrc or .zshrc shell configuration file:
export PATH="$HOME/.sui/bin:$PATH"
NOTE: The binary may be initially prevented from running if you're on macOS. See the "Open Anyway" instructions from this support forum (opens in a new tab) if that is the case.
If you are using Windows:
Please unzip $ARCHIVE_NAME and configure sui and sui-test-validator in it to the global environment.
(Method 2) Build from source
-
Clone the repository
Open a terminal and clone the sui repository:
git clone https://github.com/MystenLabs/sui.git
Change to the repository directory
cd sui
-
Checkout the latest release
Go to the sui releases (opens in a new tab) page to see what is the most recent release.
Then checkout the release, for example if the most recent release is testnet-v1.9.0 then execute the command:
git checkout testnet-v1.9.0
-
Building with cargo build
This command builds all the crates from the sui repository, namely: sui, sui-test-validator, sui-faucet etc.
cargo build --release
When using Obelisk, we only need to use
sui
andsui-test-validator
, so they need to be configured into the global environment.# Place the compiled binary in the global environment. sudo mv target/release/sui target/release/sui-test-validator /usr/local/bin
Finally, Verify that the binary was installed successfully.
sui --version