Created
March 26, 2026 02:25
-
-
Save oberonlai/f4f6b8a7a2f8e0c70118d2d437e326b5 to your computer and use it in GitHub Desktop.
Mac 一鍵安裝 Claude Code(Node.js + Git + Claude Code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -e | |
| echo "🔍 查詢最新版本..." | |
| NODE_VER=$(curl -fsSL https://nodejs.org/dist/index.json \ | |
| | python3 -c "import sys,json; print(next(v['version'].lstrip('v') for v in json.load(sys.stdin) if v.get('lts')))") | |
| echo "📦 Node.js 最新 LTS:v${NODE_VER}" | |
| curl -fsSL "https://nodejs.org/dist/v${NODE_VER}/node-v${NODE_VER}.pkg" -o /tmp/node.pkg | |
| sudo installer -pkg /tmp/node.pkg -target / | |
| rm /tmp/node.pkg | |
| echo "📦 安裝 Git..." | |
| xcode-select --install 2>/dev/null && \ | |
| osascript -e 'display dialog "請在彈出視窗點擊「安裝」,完成後回到這裡按確定" buttons {"我已完成"} default button 1' \ | |
| || echo "Git 已存在,跳過" | |
| echo "🤖 安裝 Claude Code..." | |
| npm install -g @anthropic-ai/claude-code | |
| echo "" | |
| echo "✅ 全部完成!" | |
| echo " Node → $(node -v)" | |
| echo " npm → $(npm -v)" | |
| echo " Git → $(git --version)" | |
| echo " Claude → $(claude --version)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment