# claudecode-install **Repository Path**: Crosery/claudecode-install ## Basic Information - **Project Name**: claudecode-install - **Description**: Claude Code 一键安装脚本 macOS/Linux/Windows,国内镜像加速 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-12 - **Last Updated**: 2026-05-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # claudecode-install Claude Code 一键安装脚本,跨 macOS / Linux / Windows,国内镜像加速,预装 superpowers 系列插件,附协作铁律版 CLAUDE.md。 ## 一键安装 ### macOS / Linux ```bash curl -fsSL https://gitee.com/crosery/claudecode-install/raw/main/install.sh | bash ``` ### Windows PowerShell ```powershell $wc = New-Object Net.WebClient; $wc.Encoding = [Text.Encoding]::UTF8; $wc.DownloadString('https://gitee.com/crosery/claudecode-install/raw/main/install.ps1') | iex ``` > 不要用 `iwr -useb ... | iex`。PowerShell 5.1 的 `iwr` 在 server 不带 charset header 时按 ISO-8859-1 解码 UTF-8 字节,会把脚本里的中文 log 解成 `??????`。WebClient 显式指定 UTF-8 解码。 ### Windows 双击 下载仓库 zip 解压后,双击 `install.bat`。本质是 PowerShell 启动器,自动绕 ExecutionPolicy,跑完不关窗。带开关可命令行调用: ```cmd install.bat -NoPlugins -NoMirror ``` ## 配置中转 API / 默认模型 (Windows) 装完 Claude Code 后用 `setup-api.bat` 一键配 `%USERPROFILE%\.claude\settings.json` 的 `env` + `model`。merge 不覆盖,自动备份原文件。 ```cmd setup-api.bat # 双击运行, 会交互输入 token setup-api.bat -Token sk-xxx # 命令行传 token setup-api.bat -Token sk-xxx -Model "gpt-5.5[1m]" -BaseUrl https://rehdasu.cn ``` 写入的字段: | key | 默认值 | |---|---| | `env.ANTHROPIC_BASE_URL` | `https://rehdasu.cn` | | `env.ANTHROPIC_AUTH_TOKEN` | 你传的 token | | `env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | `1` | | `env.CLAUDE_CODE_ATTRIBUTION_HEADER` | `0` | | `model` | `gpt-5.5[1m]` | 远程一键(无法传 token,会交互输入): ```powershell $wc = New-Object Net.WebClient; $wc.Encoding = [Text.Encoding]::UTF8; $wc.DownloadString('https://gitee.com/crosery/claudecode-install/raw/main/setup-api.ps1') | iex ``` ## 本地安装 ```bash git clone https://gitee.com/crosery/claudecode-install.git cd claudecode-install bash install.sh # macOS / Linux # 或 powershell -ExecutionPolicy Bypass -File install.ps1 # Windows PowerShell # 或 install.bat # Windows 双击 / cmd ``` ## 开关 | Linux / Mac | Windows | 作用 | |---|---|---| | `--no-plugins` | `-NoPlugins` | 不装预设插件 | | `--no-claudemd` | `-NoClaudeMd` | 不写全局 CLAUDE.md | | `--no-mirror` | `-NoMirror` | 关闭所有国内镜像 | | `--gh-proxy` | (Windows 默认开) | Linux/Mac 显式开 GitHub 代理;Windows 默认就开 | | | `-NoGitProxy` | Windows 只关 git 代理,npm 镜像保留 | ## Windows 国内加速做了什么 全部通过进程级 env var 注入,不污染 `~/.npmrc` 和 `~/.gitconfig`: - `npm_config_registry` → `registry.npmmirror.com` - `npm_config_disturl / electron_mirror / puppeteer_download_host / sass_binary_site / sharp_binary_host / canvas_binary_host_mirror / python_mirror / chromedriver_cdnurl / electron_builder_binaries_mirror` → npmmirror 的对应 binary 镜像 - `GIT_CONFIG_COUNT=1` + `GIT_CONFIG_KEY_0=url.https://gh-proxy.com/https://github.com/.insteadOf` + `GIT_CONFIG_VALUE_0=https://github.com/`,让 claude 内部 git clone 走 gh-proxy.com Linux/Mac 想要同款 GitHub 加速,传 `--gh-proxy`(这个会写入全局 git config,回退命令会在结尾打印)。 ## 装了什么 1. `@anthropic-ai/claude-code` 全局二进制,走 npm 镜像 `https://registry.npmmirror.com` 2. marketplace: `obra/superpowers-marketplace` 3. 默认插件: - `superpowers` - TDD / debugging / 协作模式核心 skill 库 - `superpowers-chrome` - 直连 Chrome DevTools Protocol,零依赖浏览器自动化 - `episodic-memory` - 跨会话语义检索,记住历史讨论 4. `~/.claude/CLAUDE.md` - 协作铁律(已存在会备份成 `.bak.`) ## 自定义插件清单 编辑 `install.sh` / `install.ps1` 里的 `PLUGINS` / `$plugins` 数组。可选清单从 `obra/superpowers-marketplace` 里挑: - `elements-of-style@superpowers-marketplace` - Strunk 写作规则 - `superpowers-lab@superpowers-marketplace` - tmux 自动化 / MCP 发现等实验性 skill - `superpowers-developing-for-claude-code@superpowers-marketplace` - 开发 Claude Code 插件用的资源 ## 卸载 / 回退 ```bash # 卸载 Claude Code npm uninstall -g @anthropic-ai/claude-code # 卸载插件 claude plugin uninstall superpowers@superpowers-marketplace claude plugin marketplace remove superpowers-marketplace # 恢复 CLAUDE.md (脚本运行时自动备份) ls ~/.claude/CLAUDE.md.bak.* mv ~/.claude/CLAUDE.md.bak. ~/.claude/CLAUDE.md # 关闭 gh-proxy (如启用过 --gh-proxy) git config --global --unset url.https://gh-proxy.com/https://github.com/.insteadOf ``` ## fork 后改默认 raw 地址 脚本顶部的 `RAW_BASE` / `-RawBase` 默认指向本仓库。fork 到自己 gitee 后改成你的仓库 raw 地址,远程一键脚本就能下载到你 fork 的 CLAUDE.md。