macOS Starter - Setup Skill
From Zero to Hero - AI-powered macOS development environment configuration
Quick Reference
| Command | Description |
|---|---|
/new-macos-setup | Full interactive setup wizard |
/new-macos-setup --quick | Quick setup with defaults |
/new-macos-setup --preset fullstack | Use fullstack preset |
/new-macos-setup --dry-run | Preview without installing |
Skill Capabilities
0. Network Proxy Check (前置步骤)
在开始安装前,必须确保网络可以访问 Google 和 GitHub:
bash1check_network() { 2 echo "=== Network Connectivity Check ===" 3 echo "" 4 5 # Test GitHub 6 echo "Testing GitHub..." 7 if curl -s --connect-timeout 5 https://github.com > /dev/null 2>&1; then 8 echo "✅ GitHub: accessible" 9 else 10 echo "❌ GitHub: not accessible" 11 NEED_PROXY=true 12 fi 13 14 # Test Google (for some Homebrew dependencies) 15 echo "Testing Google..." 16 if curl -s --connect-timeout 5 https://www.google.com > /dev/null 2>&1; then 17 echo "✅ Google: accessible" 18 else 19 echo "❌ Google: not accessible" 20 NEED_PROXY=true 21 fi 22 23 # Test Homebrew 24 echo "Testing Homebrew..." 25 if curl -s --connect-timeout 5 https://raw.githubusercontent.com > /dev/null 2>&1; then 26 echo "✅ Homebrew sources: accessible" 27 else 28 echo "❌ Homebrew sources: not accessible" 29 NEED_PROXY=true 30 fi 31 32 if [ "$NEED_PROXY" = true ]; then 33 echo "" 34 echo "⚠️ Network issues detected. Proxy configuration required." 35 return 1 36 fi 37 38 echo "" 39 echo "✅ Network OK - Ready to proceed" 40 return 0 41}
代理配置流程:
- 询问用户代理信息:
yaml1questions: 2 - id: proxy_needed 3 question: "Do you need to configure a network proxy to access GitHub/Google?" 4 options: 5 - label: "Yes, I have a proxy" 6 description: "Configure HTTP/HTTPS proxy" 7 - label: "No, direct connection works" 8 description: "Skip proxy configuration" 9 10 - id: proxy_config 11 question: "Please provide your proxy configuration:" 12 condition: "proxy_needed == 'Yes'" 13 inputs: 14 - label: "Proxy URL" 15 placeholder: "http://127.0.0.1:7890" 16 example: "http://127.0.0.1:7890 or socks5://127.0.0.1:1080"
- 设置临时环境变量:
bash1setup_proxy() { 2 local proxy_url="$1" 3 4 if [ -n "$proxy_url" ]; then 5 echo "Setting proxy: $proxy_url" 6 export http_proxy="$proxy_url" 7 export https_proxy="$proxy_url" 8 export HTTP_PROXY="$proxy_url" 9 export HTTPS_PROXY="$proxy_url" 10 export ALL_PROXY="$proxy_url" 11 12 # For Git 13 git config --global http.proxy "$proxy_url" 14 git config --global https.proxy "$proxy_url" 15 16 echo "✅ Proxy configured for this session" 17 echo "" 18 echo "To make permanent, add to ~/.zshrc:" 19 echo " export http_proxy=\"$proxy_url\"" 20 echo " export https_proxy=\"$proxy_url\"" 21 fi 22}
- 验证代理是否工作:
bash1verify_proxy() { 2 echo "Verifying proxy configuration..." 3 4 if curl -s --connect-timeout 5 https://github.com > /dev/null 2>&1; then 5 echo "✅ GitHub accessible via proxy" 6 else 7 echo "❌ GitHub still not accessible" 8 return 1 9 fi 10 11 if curl -s --connect-timeout 5 https://www.google.com > /dev/null 2>&1; then 12 echo "✅ Google accessible via proxy" 13 else 14 echo "❌ Google still not accessible" 15 return 1 16 fi 17 18 echo "✅ Proxy verification passed" 19 return 0 20}
1. System Detection
Detect installed software and versions:
bash1# Core tools detection script 2detect_installed() { 3 echo "=== System Detection ===" 4 5 # Homebrew 6 if command -v brew &>/dev/null; then 7 echo "✅ Homebrew: $(brew --version | head -1)" 8 else 9 echo "❌ Homebrew: not installed" 10 fi 11 12 # Shell 13 echo "✅ Shell: $SHELL" 14 [ -d "$HOME/.oh-my-zsh" ] && echo "✅ Oh-My-Zsh: installed" 15 command -v starship &>/dev/null && echo "✅ Starship: installed" 16 17 # Git 18 command -v git &>/dev/null && echo "✅ Git: $(git --version)" 19 command -v gh &>/dev/null && echo "✅ GitHub CLI: installed" 20 command -v delta &>/dev/null && echo "✅ Delta: installed" 21 22 # Modern CLI 23 command -v eza &>/dev/null && echo "✅ eza: installed" 24 command -v bat &>/dev/null && echo "✅ bat: installed" 25 command -v fd &>/dev/null && echo "✅ fd: installed" 26 command -v rg &>/dev/null && echo "✅ ripgrep: installed" 27 28 # Languages 29 command -v fnm &>/dev/null && echo "✅ fnm: installed" 30 command -v node &>/dev/null && echo "✅ Node.js: $(node --version)" 31 command -v pnpm &>/dev/null && echo "✅ pnpm: installed" 32 command -v uv &>/dev/null && echo "✅ uv: installed" 33 command -v python3 &>/dev/null && echo "✅ Python: $(python3 --version)" 34 command -v goenv &>/dev/null && echo "✅ goenv: installed" 35 command -v go &>/dev/null && echo "✅ Go: $(go version)" 36 37 # Container 38 command -v docker &>/dev/null && echo "✅ Docker: installed" 39 command -v kubectl &>/dev/null && echo "✅ kubectl: installed" 40 command -v helm &>/dev/null && echo "✅ Helm: installed" 41 command -v k9s &>/dev/null && echo "✅ k9s: installed" 42 43 # Applications 44 [ -d "/Applications/Raycast.app" ] && echo "✅ Raycast: installed" 45 [ -d "/Applications/Warp.app" ] && echo "✅ Warp: installed" 46 [ -d "/Applications/Visual Studio Code.app" ] && echo "✅ VS Code: installed" 47 [ -d "/Applications/OrbStack.app" ] && echo "✅ OrbStack: installed" 48 49 # Vibe Coding Tools 50 echo "" 51 echo "--- Vibe Coding Tools ---" 52 command -v claude &>/dev/null && echo "✅ Claude Code: $(claude --version 2>/dev/null | head -1 || echo 'installed')" || echo "❌ Claude Code" 53 command -v ccline &>/dev/null && echo "✅ CCometixLine: installed" || echo "❌ CCometixLine" 54 [ -d "/Applications/Cursor.app" ] && echo "✅ Cursor: installed" || echo "❌ Cursor" 55 command -v opencode &>/dev/null && echo "✅ OpenCode: installed" || echo "❌ OpenCode" 56 [ -d "/Applications/Cherry Studio.app" ] && echo "✅ Cherry Studio: installed" || echo "❌ Cherry Studio" 57 [ -d "/Applications/LM Studio.app" ] && echo "✅ LM Studio: installed" || echo "❌ LM Studio" 58}
2. Interactive Q&A Flow
Use AskUserQuestion tool with structured questions:
yaml1questions: 2 - id: role 3 question: "What best describes your primary development role?" 4 options: 5 - label: "Fullstack Developer" 6 description: "React/Vue + Node.js + Database" 7 - label: "Frontend Developer" 8 description: "React/Vue/Svelte + UI/Design tools" 9 - label: "Backend Developer" 10 description: "Go/Python/Java + APIs + Infrastructure" 11 - label: "Data/ML Engineer" 12 description: "Python + Jupyter + ML frameworks" 13 - label: "DevOps/Platform" 14 description: "K8s + Terraform + CI/CD" 15 16 - id: languages 17 question: "Which programming languages do you need?" 18 multiSelect: true 19 options: 20 - label: "JavaScript/TypeScript" 21 description: "fnm + Node.js LTS + pnpm" 22 - label: "Python" 23 description: "uv + Python 3.12" 24 - label: "Go" 25 description: "goenv + latest Go" 26 - label: "Rust" 27 description: "rustup + stable" 28 29 - id: containers 30 question: "Do you need container and Kubernetes tools?" 31 options: 32 - label: "Full K8s setup" 33 description: "OrbStack + kubectl + helm + k9s + stern" 34 - label: "Docker only" 35 description: "OrbStack for containers" 36 - label: "Skip" 37 description: "No container tools" 38 39 - id: vibe_coding 40 question: "Which additional Vibe Coding tools do you need?" 41 multiSelect: true 42 note: "We assume you already have at least one AI coding tool installed to use this project." 43 detection: | 44 command -v claude &>/dev/null && echo "✅ Claude Code installed" 45 command -v ccline &>/dev/null && echo "✅ CCometixLine installed" 46 [ -d "/Applications/Cursor.app" ] && echo "✅ Cursor installed" 47 command -v opencode &>/dev/null && echo "✅ OpenCode installed" 48 [ -d "/Applications/Cherry Studio.app" ] && echo "✅ Cherry Studio installed" 49 options: 50 - label: "Claude Code" 51 description: "Anthropic's official agentic CLI" 52 skip_if: "command -v claude &>/dev/null" 53 - label: "CCometixLine" 54 description: "Claude Code statusline enhancer (Git, model, context)" 55 skip_if: "command -v ccline &>/dev/null" 56 requires: "Node.js" 57 - label: "Cursor" 58 description: "AI-first code editor" 59 skip_if: "[ -d '/Applications/Cursor.app' ]" 60 - label: "OpenCode" 61 description: "Open-source terminal AI assistant" 62 skip_if: "command -v opencode &>/dev/null" 63 - label: "Cherry Studio" 64 description: "AI desktop client with multi-model support" 65 skip_if: "[ -d '/Applications/Cherry Studio.app' ]" 66 67 - id: apps 68 question: "Which collaboration apps?" 69 multiSelect: true 70 options: 71 - label: "Work (CN)" 72 description: "Lark + DingTalk + WeCom" 73 - label: "International" 74 description: "Slack + Discord + WhatsApp" 75 - label: "Meetings" 76 description: "Tencent Meeting + Zoom" 77 78 - id: macos 79 question: "macOS optimizations?" 80 multiSelect: true 81 options: 82 - label: "Dock" 83 description: "Hide recent apps, faster animations" 84 - label: "Keyboard" 85 description: "Faster repeat, disable auto-correct" 86 - label: "Finder" 87 description: "Show hidden files, path bar" 88 - label: "Screenshots" 89 description: "Save to ~/Pictures/Screenshots"
3. Plan Generation
Generate structured installation plan based on answers:
markdown1## Generated Plan for: [User Name] 2 3### Phase 1: Prerequisites 4- [ ] Xcode Command Line Tools 5- [ ] Homebrew 6 7### Phase 2: CLI Tools 8| Package | Purpose | Command | 9|---------|---------|---------| 10| git | Version control | `brew install git` | 11| gh | GitHub CLI | `brew install gh` | 12| delta | Better diffs | `brew install delta` | 13| starship | Modern prompt | `brew install starship` | 14| eza | ls replacement | `brew install eza` | 15| bat | cat replacement | `brew install bat` | 16| fd | find replacement | `brew install fd` | 17| ripgrep | grep replacement | `brew install ripgrep` | 18 19### Phase 3: Language Environments 20| Language | Manager | Setup Command | 21|----------|---------|---------------| 22| Node.js | fnm | `fnm install --lts && fnm default lts-latest` | 23| Python | uv | `uv python install 3.12` | 24| Go | goenv | `goenv install latest && goenv global latest` | 25 26### Phase 4: Applications 27| App | Purpose | Command | 28|-----|---------|---------| 29| Raycast | Launcher + window mgmt | `brew install --cask raycast` | 30| Warp | Modern terminal | `brew install --cask warp` | 31| OrbStack | Docker/K8s | `brew install --cask orbstack` | 32 33### Phase 5: Vibe Coding Tools 34> Note: Skip already installed tools 35 36| Tool | Purpose | Command | Skip If | 37|------|---------|---------|---------| 38| Claude Code | Anthropic agentic CLI | `brew install --cask claude-code` | `command -v claude` | 39| CCometixLine | Claude Code statusline | `npm install -g @cometix/ccline` | `command -v ccline` | 40| Cursor | AI-first code editor | `brew install --cask cursor` | App exists | 41| OpenCode | Open-source terminal AI | `brew install opencode` | `command -v opencode` | 42| Cherry Studio | Multi-model AI client | `brew install --cask cherry-studio` | App exists | 43 44### Phase 6: Fonts 45| Font | Purpose | 46|------|---------| 47| JetBrains Mono Nerd Font | Terminal icons | 48| Fira Code | Ligatures | 49| Inter | UI font | 50 51### Phase 7: Shell Configuration 52- [ ] Zsh plugins (autosuggestions, syntax-highlighting) 53- [ ] Starship prompt 54- [ ] Modern CLI aliases 55 56### Phase 8: macOS Defaults 57- [ ] Dock optimization 58- [ ] Keyboard settings 59- [ ] Finder preferences
4. Execution Engine
Execute plan with progress tracking:
bash1# Example execution with progress 2execute_phase() { 3 local phase=$1 4 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━" 5 echo "📦 Phase $phase" 6 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━" 7} 8 9# Phase 1: CLI Tools 10execute_phase "1: CLI Tools" 11brew install git gh delta starship 12brew install eza bat fd ripgrep sd dust procs bottom 13brew install tree wget curl jq yq 14 15# Phase 2: Languages 16execute_phase "2: Language Environments" 17brew install fnm uv goenv go 18fnm install --lts 19fnm default lts-latest 20npm install -g pnpm 21 22# Phase 3: Apps 23execute_phase "3: Applications" 24brew install --cask raycast warp orbstack 25 26# Phase 4: Vibe Coding (with skip detection) 27execute_phase "4: Vibe Coding Tools" 28 29# Claude Code 30if ! command -v claude &>/dev/null; then 31 echo "📦 Installing Claude Code..." 32 brew install --cask claude-code 33else 34 echo "⏭️ Claude Code already installed, skipping" 35fi 36 37# CCometixLine (requires Node.js) 38if ! command -v ccline &>/dev/null; then 39 if command -v npm &>/dev/null; then 40 echo "📦 Installing CCometixLine..." 41 npm install -g @cometix/ccline 42 echo "💡 Configure: Add to ~/.claude/settings.json:" 43 echo ' {"statusLine": {"type": "command", "command": "ccline"}}' 44 else 45 echo "⚠️ CCometixLine requires Node.js, install fnm/node first" 46 fi 47else 48 echo "⏭️ CCometixLine already installed, skipping" 49fi 50 51# Cursor 52if [ ! -d "/Applications/Cursor.app" ]; then 53 echo "📦 Installing Cursor..." 54 brew install --cask cursor 55else 56 echo "⏭️ Cursor already installed, skipping" 57fi 58 59# OpenCode 60if ! command -v opencode &>/dev/null; then 61 echo "📦 Installing OpenCode..." 62 brew install opencode 63else 64 echo "⏭️ OpenCode already installed, skipping" 65fi 66 67# Cherry Studio 68if [ ! -d "/Applications/Cherry Studio.app" ]; then 69 echo "📦 Installing Cherry Studio..." 70 brew install --cask cherry-studio 71else 72 echo "⏭️ Cherry Studio already installed, skipping" 73fi 74 75# Phase 5: Fonts 76execute_phase "5: Fonts" 77brew install --cask font-jetbrains-mono-nerd-font 78brew install --cask font-fira-code font-inter 79 80# Phase 6: Shell 81execute_phase "6: Shell Configuration" 82# Install zsh plugins... 83# Configure starship... 84 85# Phase 7: macOS 86execute_phase "7: macOS Optimization" 87defaults write com.apple.dock show-recents -bool false 88defaults write NSGlobalDomain KeyRepeat -int 2 89# ... 90 91echo "✅ Setup complete!"
Presets
fullstack
yaml1name: Fullstack Developer 2languages: [javascript, python] 3containers: full 4apps: [raycast, warp, cursor, orbstack, notion] 5macos: [dock, keyboard]
frontend
yaml1name: Frontend Developer 2languages: [javascript] 3containers: docker 4apps: [raycast, cursor, figma] 5macos: [dock, keyboard]
backend
yaml1name: Backend Developer 2languages: [go, python] 3containers: full 4cloud: [aws] 5apps: [raycast, warp, cursor, orbstack] 6macos: [dock, keyboard, finder]
data
yaml1name: Data/ML Engineer 2languages: [python] 3containers: docker 4apps: [cursor, jupyter] 5macos: [keyboard]
devops
yaml1name: DevOps Engineer 2languages: [go, python] 3containers: full 4cloud: [aws, gcp] 5apps: [raycast, warp, orbstack] 6macos: [dock, keyboard, finder]
Configuration Files
This skill references:
presets.md- Detailed preset configurationspackages.md- Complete package registry../../scripts/Brewfile- Homebrew bundle../../configs/- Configuration templates
Best Practices
- Always detect first - Never reinstall what exists
- Ask, don't assume - User preferences matter
- Show before doing - Display plan before execution
- Progress tracking - Use TodoWrite for visibility
- Verify after - Confirm installations succeeded
- Non-destructive - Never remove existing tools
Error Handling
bash1# Retry failed installations 2retry_install() { 3 local cmd=$1 4 local max_attempts=3 5 local attempt=1 6 7 while [ $attempt -le $max_attempts ]; do 8 if eval "$cmd"; then 9 return 0 10 fi 11 echo "⚠️ Attempt $attempt failed, retrying..." 12 ((attempt++)) 13 sleep 2 14 done 15 16 echo "❌ Failed after $max_attempts attempts" 17 return 1 18}
Trigger Keywords
This skill activates on:
/new-macos-setup- "setup macos"
- "configure mac"
- "new mac setup"
- "dev environment"
- "install development tools"