Cargo / Update Sui From Source
Update Sui From Source
Easily update the SUI package from the latest source on GitHub using Cargo.
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui #!/bin/bash
# Update Sui From Source
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui import subprocess
# Update Sui From Source
# Make sure to replace <placeholders> with actual values
def run_command():
cmd = [
"cargo",
"install",
"--locked",
"--git",
"https://github.com/MystenLabs/sui.git",
"--branch",
"testnet",
"sui"
]
try:
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: cargo not found. Please install it first.")
if __name__ == "__main__":
run_command() When To Use
Updating your SUI installation to the latest version from the testnet branch.
Terminal Output
Expected runtime feedback
Updating crates...
Compiling sui v0.1.0 (https://github.com/MystenLabs/sui.git?branch=testnet)
Finished dev [unoptimized + debuginfo] target(s) in 1.23s
Installed package 'sui' from source. Power User Variants
Optimized versions
cargo install --git https://github.com/MystenLabs/sui.git sui Install SUI from the latest commit on the default branch.
cargo install --git https://github.com/MystenLabs/sui.git --branch main sui Install SUI from the main branch of the repository.
Troubleshooting
Common pitfalls
Failed to clone repository
Solution: Check the repository URL and your internet connection.
Permission denied
Solution: Ensure you have the necessary permissions to install packages.
Command Breakdown
What each part is doing
-
cargo - Base Command
- The executable that performs this operation. Here it runs Cargo before the shell applies any redirect operators.
-
--locked - Command Option
- Tool-specific option used by this command invocation.
-
--git - Command Option
- Tool-specific option used by this command invocation.
-
--branch - Command Option
- Tool-specific option used by this command invocation.
How To Run
Execution path
- Step 1
Open your terminal.
- Step 2
Run the command: cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui.
- Step 3
Verify the installation by checking the version of SUI.
Alternative Approaches
Comparable commands in other tools
Alternative build tools tools for the same job.