Claude Code 원클릭 설치 스크립트
크레딧을 이미 구매하셨다면 원클릭 스크립트를 바로 사용할 수도 있습니다. 스크립트의 API_KEY를 본인의 키로 바꾸고 실행하기만 하면 됩니다.
사용 방법
bash
chmod +x claudecode.sh
./claudecode.sh전체 스크립트
bash
#!/bin/bash
# ==============================================================================
# 설정 영역 - 여기에서 API 설정을 지정하세요
# ==============================================================================
readonly API_KEY=""
readonly API_BASE_URL="https://api.nexthub.cc"
# 아래 내용은 수정하지 마세요
readonly CLAUDE_COMMAND="claude"
readonly NPM_PACKAGE="@anthropic-ai/claude-code"
readonly CLAUDE_DIR="$HOME/.claude"
readonly SETTINGS_FILE="$CLAUDE_DIR/settings.json"
detect_os() {
case "$(uname -s)" in
Darwin) echo "macos" ;;
Linux) echo "linux" ;;
*) echo "unknown" ;;
esac
}
check_config() {
if [ -z "$API_KEY" ] || [ -z "$API_BASE_URL" ]; then
echo "설정이 완전하지 않습니다. API_KEY와 API_BASE_URL을 입력하세요"
exit 1
fi
}
install_homebrew() {
if ! command -v brew > /dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
}
install_macos_packages() {
install_homebrew
command -v node > /dev/null || brew install node
command -v jq > /dev/null || brew install jq
command -v python3 > /dev/null || brew install python3
}
install_linux_packages() {
if command -v apt-get > /dev/null; then
sudo apt-get update
command -v node > /dev/null || { curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs; }
command -v jq > /dev/null || sudo apt-get install -y jq
command -v python3 > /dev/null || sudo apt-get install -y python3 python3-pip
fi
}
install_claude_code() {
command -v "$CLAUDE_COMMAND" > /dev/null && return
# 우선 sudo 없이 설치하고, Linux 시스템급 Node에서 흔한 EACCES 권한 오류가 발생할 때 sudo로 재시도하세요
npm install -g "$NPM_PACKAGE" || sudo npm install -g "$NPM_PACKAGE"
}
configure_claude_code() {
mkdir -p "$CLAUDE_DIR"
cat > "$SETTINGS_FILE" << EOF
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "$API_KEY",
"ANTHROPIC_BASE_URL": "$API_BASE_URL",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}
EOF
}
main() {
check_config
OS=$(detect_os)
case "$OS" in
macos) install_macos_packages ;;
linux) install_linux_packages ;;
*) echo "지원되지 않는 운영체제입니다"; exit 1 ;;
esac
install_claude_code
configure_claude_code
echo "설치가 완료되었습니다. 이제 claude를 실행할 수 있습니다!"
}
main "$@"사용 설명
스크립트는 Node.js, jq, Python3 등 의존성을 자동으로 설치하고 ~/.claude/settings.json을 자동으로 생성하거나 덮어씁니다 (기존 설정을 먼저 백업하는 것을 권장합니다). 기록되는 ANTHROPIC_BASE_URL은 https://api.nexthub.cc이며 /v1 접미사를 붙이지 마세요. Linux에서 전역 설치 시 권한 오류(EACCES)가 발생하면 스크립트가 자동으로 sudo로 재시도합니다.
시작할 준비가 되셨나요?
NextHub에 가입하고 높은 안정성과 뛰어난 가성비를 갖춘 AI 모델 API 서비스를 지금 바로 경험해 보세요.