Files
install-sh/install-claude-code.ps1
T

76 lines
3.5 KiB
PowerShell
Raw Normal View History

2026-06-02 11:31:45 +09:00
#Requires -Version 5.1
<#
.SYNOPSIS
Installs Claude Code (Anthropic's command-line AI assistant) on Windows using PowerShell.
2026-06-02 11:31:45 +09:00
.DESCRIPTION
Installs Claude Code natively by invoking the official install.ps1 script.
2026-06-02 11:31:45 +09:00
This native installation method is recommended for Windows.
Official Guide: https://code.claude.com/docs/ko/quickstart#native-install-recommended
2026-06-02 11:31:45 +09:00
.EXAMPLE
.\install-claude-code.ps1
# One-liner install from remote (works on Windows 10+):
powershell -ExecutionPolicy Bypass -c "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $t=\"$env:TEMP\install-claude-code.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-claude-code.ps1' -OutFile $t; & $t"
.NOTES
If execution policy error occurs:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
#>
[CmdletBinding()]
param()
# 최신 윈도우 환경 및 에러 발생 시 즉시 중단 설정
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
# HTTPS 다운로드를 위한 TLS 1.2 강제 (PowerShell 5.1 호환성 보장)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# ────────────────────────────────────────────
# 유틸리티 함수 정의 (모든 안내 문구는 영문으로 작성)
# ────────────────────────────────────────────
function Write-Info { param([string]$msg) Write-Host "[INFO] $msg" -ForegroundColor Cyan }
function Write-Warn { param([string]$msg) Write-Host "[WARN] $msg" -ForegroundColor Yellow }
function Write-Success { param([string]$msg) Write-Host "[OK] $msg" -ForegroundColor Green }
function Write-Err { param([string]$msg) Write-Host "[ERROR] $msg" -ForegroundColor Red; exit 1 }
# ────────────────────────────────────────────
# 메인 설치 프로세스
# ────────────────────────────────────────────
function Main {
Write-Info "===== Claude Code install script (Windows PowerShell) ====="
Write-Info "Installing Claude Code (command-line AI assistant) natively..."
2026-09-09 13:21:42 +09:00
$tmpDir = Join-Path $env:TEMP "claude_install_$(Get-Random)"
New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null
$scriptPath = Join-Path $tmpDir "bootstrap.ps1"
2026-09-09 13:21:42 +09:00
try {
Write-Info "Downloading official installer from: https://downloads.claude.ai/claude-code-releases/bootstrap.ps1"
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://downloads.claude.ai/claude-code-releases/bootstrap.ps1" -OutFile $scriptPath -UseBasicParsing
$ProgressPreference = 'Continue'
if (-not (Test-Path $scriptPath)) {
Write-Err "Failed to download official Claude Code bootstrap installer."
}
Write-Info "Executing official Claude Code installer..."
& $scriptPath
2026-06-02 11:31:45 +09:00
Write-Success "Claude Code has been successfully installed!"
Write-Info "Please restart your terminal window or refresh your PATH environment variable."
Write-Info "Run command: claude"
} catch {
Write-Err "Failed to install Claude Code: $_"
2026-09-09 13:21:42 +09:00
} finally {
if (Test-Path $tmpDir) {
Remove-Item -Path $tmpDir -Recurse -Force -ErrorAction SilentlyContinue
}
2026-06-02 11:31:45 +09:00
}
}
Main