-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick-install-sui.ps1
More file actions
84 lines (70 loc) · 3.32 KB
/
quick-install-sui.ps1
File metadata and controls
84 lines (70 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Quick Sui CLI Installation Script for Windows
Write-Host "🚀 Installing Sui CLI for Windows..." -ForegroundColor Green
# Create sui directory
$suiDir = "C:\sui"
if (!(Test-Path $suiDir)) {
New-Item -ItemType Directory -Path $suiDir -Force
Write-Host "✅ Created directory: $suiDir" -ForegroundColor Green
}
# Download URL for latest Sui Windows binary
$downloadUrl = "https://github.com/MystenLabs/sui/releases/latest/download/sui-mainnet-v1.36.4-x86_64-pc-windows-msvc.tgz"
$zipPath = "$suiDir\sui.tgz"
try {
Write-Host "📥 Downloading Sui CLI..." -ForegroundColor Blue
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath -UseBasicParsing
Write-Host "✅ Download completed" -ForegroundColor Green
# Extract the binary
Write-Host "📦 Extracting binary..." -ForegroundColor Blue
tar -xzf $zipPath -C $suiDir
# Move binary to the right location
if (Test-Path "$suiDir\target\release\sui.exe") {
Move-Item "$suiDir\target\release\sui.exe" "$suiDir\sui.exe" -Force
Remove-Item "$suiDir\target" -Recurse -Force
}
# Clean up
Remove-Item $zipPath -Force
Write-Host "✅ Sui CLI installed to: $suiDir\sui.exe" -ForegroundColor Green
} catch {
Write-Host "❌ Download failed. Trying alternative method..." -ForegroundColor Red
# Alternative: Try to install via chocolatey
try {
Write-Host "📦 Trying Chocolatey installation..." -ForegroundColor Blue
choco install sui -y
Write-Host "✅ Sui installed via Chocolatey" -ForegroundColor Green
return
} catch {
Write-Host "❌ Chocolatey installation failed" -ForegroundColor Red
}
# Manual instructions
Write-Host ""
Write-Host "⚠️ Automatic installation failed. Please install manually:" -ForegroundColor Yellow
Write-Host "1. Visit: https://github.com/MystenLabs/sui/releases" -ForegroundColor White
Write-Host "2. Download the Windows .zip file" -ForegroundColor White
Write-Host "3. Extract sui.exe to C:\sui\" -ForegroundColor White
Write-Host "4. Add C:\sui to your PATH environment variable" -ForegroundColor White
return
}
# Add to PATH if not already there
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($currentPath -notlike "*$suiDir*") {
Write-Host "🔧 Adding Sui to PATH..." -ForegroundColor Blue
[Environment]::SetEnvironmentVariable("PATH", "$currentPath;$suiDir", "User")
$env:PATH += ";$suiDir"
Write-Host "✅ Added $suiDir to PATH" -ForegroundColor Green
}
# Test installation
try {
$suiVersion = & "$suiDir\sui.exe" --version
Write-Host "✅ Sui CLI installed successfully: $suiVersion" -ForegroundColor Green
Write-Host ""
Write-Host "🎉 Installation Complete!" -ForegroundColor Magenta
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Restart PowerShell or run: refreshenv" -ForegroundColor White
Write-Host "2. Run: sui client" -ForegroundColor White
Write-Host "3. Set up testnet and request tokens" -ForegroundColor White
Write-Host "4. Build your project: .\build.ps1" -ForegroundColor White
} catch {
Write-Host "⚠️ Installation completed but sui command not working yet." -ForegroundColor Yellow
Write-Host "Please restart PowerShell and try again." -ForegroundColor White
}