-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·863 lines (738 loc) · 26.7 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·863 lines (738 loc) · 26.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
#!/bin/bash
# macOS Development Environment - Automated Installation Script
# This script installs all tools and configures your development environment
#
# Usage:
# ./install.sh # Full installation
# ./install.sh --dry-run # Preview what will be installed
# ./install.sh --help # Show usage information
set -e # Exit on error
set -u # Exit on undefined variable
set -o pipefail # Exit on pipe failure
# Get script directory for absolute paths
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Parse command line arguments
DRY_RUN=false
for arg in "$@"; do
case $arg in
--dry-run)
DRY_RUN=true
shift
;;
--help)
echo "macOS Development Environment - Installation Script"
echo ""
echo "Usage:"
echo " ./install.sh # Full installation (default)"
echo " ./install.sh --dry-run # Preview what will be installed"
echo " ./install.sh --help # Show this help message"
echo ""
echo "Dry-run mode will:"
echo " - Show all packages that would be installed"
echo " - Display estimated disk space required"
echo " - Display estimated installation time"
echo " - NOT make any changes to your system"
echo ""
exit 0
;;
*)
echo "Unknown option: $arg"
echo "Run './install.sh --help' for usage information"
exit 1
;;
esac
done
# Log all output to install.log (skip in dry-run mode)
if [ "$DRY_RUN" = false ]; then
LOG_FILE="$SCRIPT_DIR/install.log"
: > "$LOG_FILE"
exec > >(tee -a "$LOG_FILE")
exec 2> >(tee -a "$LOG_FILE" >&2)
fi
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Helper functions
print_header() {
echo ""
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}$1${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
}
print_success() {
echo -e "${GREEN}✓${NC} "$1""
}
print_warning() {
echo -e "${YELLOW}⚠${NC} "$1""
}
print_error() {
echo -e "${RED}✗${NC} "$1""
}
print_info() {
echo -e "${BLUE}ℹ${NC} "$1""
}
# Source package configuration
PACKAGE_CONFIG="$SCRIPT_DIR/config/packages.conf"
if [ ! -f "$PACKAGE_CONFIG" ]; then
print_error "Configuration file not found: config/packages.conf"
exit 1
fi
# shellcheck disable=SC1091
source "$PACKAGE_CONFIG"
#######################################
# Dry-Run Mode
#######################################
if [ "$DRY_RUN" = true ]; then
clear
print_header "Installation Preview (Dry Run)"
print_info "This is a preview - NO changes will be made to your system"
echo ""
print_header "What Will Be Installed"
echo ""
echo -e "${BLUE}1. Homebrew Packages (${#FORMULAE[@]} total):${NC}"
for formula in "${FORMULAE[@]}"; do
echo " • $formula"
done
echo ""
echo -e "${BLUE}2. Applications (${#CASKS[@]} total):${NC}"
for cask in "${CASKS[@]}"; do
echo " • $cask"
done
echo ""
echo -e "${BLUE}3. VS Code Extensions (${#VSCODE_EXTENSIONS[@]} total):${NC}"
for ext in "${VSCODE_EXTENSIONS[@]}"; do
echo " • $ext"
done
echo ""
echo -e "${BLUE}4. Additional Components:${NC}"
echo " • Claude Code CLI (installed early)"
echo " • GitHub CLI authentication"
echo " • Node.js LTS (via nvm)"
echo " • MCP Servers (Codex, Gemini)"
echo " • PostgreSQL 17 service"
echo " • Docker Desktop"
echo " • Shell configuration (zshrc, zprofile)"
echo " • Ghostty terminal configuration"
echo ""
print_header "Estimated Resources"
TOTAL_PACKAGES=$((${#FORMULAE[@]} + ${#CASKS[@]} + ${#VSCODE_EXTENSIONS[@]}))
echo -e "${BLUE}Total packages to install:${NC} $TOTAL_PACKAGES"
echo -e "${BLUE}Estimated disk space:${NC} ~5-8 GB"
echo -e "${BLUE}Estimated time:${NC} 15-30 minutes (depends on internet speed)"
echo ""
print_header "Installation Steps Preview"
echo " 1. Install Homebrew (if not present)"
echo " 2. Install Claude Code CLI"
echo " 3. Install Homebrew packages (${#FORMULAE[@]} formulae)"
echo " 4. Configure GitHub CLI authentication"
echo " 5. Install Node.js via nvm"
echo " 6. Install NPM packages (if any)"
echo " 7. Install applications (${#CASKS[@]} casks)"
echo " 8. Install VS Code extensions (${#VSCODE_EXTENSIONS[@]} extensions)"
echo " 9. Configure shell and terminal"
echo " 10. Start PostgreSQL service"
echo " 11. Launch Docker Desktop"
echo " 12. Configure MCP servers"
echo " 13. Run verification checks"
echo " 14. Set up auto-update system (git hooks)"
echo ""
print_header "Next Steps"
print_success "Dry-run complete! No changes were made."
echo ""
print_info "To proceed with installation:"
echo " ./install.sh"
echo ""
print_info "To customize packages before installing:"
echo " 1. Edit: config/packages.conf"
echo " 2. Run: ./install.sh --dry-run (to preview)"
echo " 3. Run: ./install.sh (to install)"
echo ""
exit 0
fi
#######################################
# Auto-Fix Helper Functions
#######################################
# Check and install Xcode Command Line Tools if missing
check_xcode_tools() {
if ! xcode-select -p &>/dev/null; then
print_warning "Xcode Command Line Tools not found"
print_info "Installing Xcode Command Line Tools automatically..."
# Install without GUI prompt
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
PROD=$(softwareupdate -l | grep "\*.*Command Line" | tail -n 1 | sed 's/^[^C]* //')
if [ -n "$PROD" ]; then
softwareupdate -i "$PROD" --verbose
rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
print_success "Xcode Command Line Tools installed"
return 0
else
# Fallback to interactive installation
xcode-select --install &>/dev/null || true
print_info "Please complete the Xcode Command Line Tools installation in the popup"
print_info "Press ENTER when installation is complete..."
read -r
if xcode-select -p &>/dev/null; then
print_success "Xcode Command Line Tools installed"
return 0
else
print_error "Xcode Command Line Tools installation failed"
return 1
fi
fi
fi
return 0
}
# Check and configure SSH keys for GitHub
check_ssh_keys() {
local ssh_key_path="$HOME/.ssh/id_ed25519"
local ssh_pub_key_path="${ssh_key_path}.pub"
# Check if SSH key exists
if [ ! -f "$ssh_key_path" ]; then
print_warning "No SSH key found for GitHub"
print_info "Generating SSH key automatically..."
# Create .ssh directory if it doesn't exist
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
# Generate SSH key (no passphrase for automation)
ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)" -f "$ssh_key_path" -N "" &>/dev/null
if [ -f "$ssh_key_path" ]; then
print_success "SSH key generated at $ssh_key_path"
# Start ssh-agent and add key
eval "$(ssh-agent -s)" &>/dev/null
ssh-add "$ssh_key_path" &>/dev/null 2>&1 || true
# Add to SSH config for persistence
if [ ! -f "$HOME/.ssh/config" ]; then
cat > "$HOME/.ssh/config" <<EOF
Host github.com
AddKeysToAgent yes
IdentityFile $ssh_key_path
EOF
chmod 600 "$HOME/.ssh/config"
elif ! grep -q "github.com" "$HOME/.ssh/config"; then
cat >> "$HOME/.ssh/config" <<EOF
Host github.com
AddKeysToAgent yes
IdentityFile $ssh_key_path
EOF
fi
# Display public key for user to add to GitHub
echo ""
print_info "Your SSH public key (add this to GitHub):"
echo ""
cat "$ssh_pub_key_path"
echo ""
print_info "To add this key to GitHub:"
echo " 1. Go to: https://github.com/settings/keys"
echo " 2. Click 'New SSH key'"
echo " 3. Paste the key above"
echo " 4. Click 'Add SSH key'"
echo ""
read -r -p "Press ENTER after adding the key to GitHub..."
echo ""
return 0
else
print_error "Failed to generate SSH key"
return 1
fi
else
# Key exists, make sure it's added to agent
eval "$(ssh-agent -s)" &>/dev/null
ssh-add "$ssh_key_path" &>/dev/null 2>&1 || true
return 0
fi
}
# Test SSH connection to GitHub
test_github_ssh() {
if ssh -T git@github.com 2>&1 | grep -q "successfully authenticated"; then
return 0
else
return 1
fi
}
# Check internet connectivity
check_network() {
if ping -c 1 github.com &>/dev/null || ping -c 1 google.com &>/dev/null; then
return 0
else
print_error "No internet connection detected"
print_info "Please check your network connection and try again"
return 1
fi
}
# Retry a command with exponential backoff
retry_command() {
local max_attempts="$1"
shift
local command=("$@")
local attempt=1
local delay=2
while [ $attempt -le "$max_attempts" ]; do
if "${command[@]}"; then
return 0
fi
if [ $attempt -lt "$max_attempts" ]; then
print_warning "Attempt $attempt failed, retrying in ${delay}s..."
sleep $delay
delay=$((delay * 2))
fi
attempt=$((attempt + 1))
done
return 1
}
# Start installation
clear
print_header "macOS Development Environment Setup"
print_info "This will install all development tools and configure your environment."
print_info "Estimated time: 10-30 minutes depending on internet speed."
echo ""
read -r -p "Press ENTER to continue or Ctrl+C to cancel..."
# Check if running on macOS
if [[ "$OSTYPE" != "darwin"* ]]; then
print_error "This script is designed for macOS only!"
exit 1
fi
print_success "Running on macOS"
# Check internet connectivity
print_info "Checking internet connectivity..."
if ! check_network; then
exit 1
fi
print_success "Internet connection verified"
# Check and install Xcode Command Line Tools
print_info "Checking Xcode Command Line Tools..."
if ! check_xcode_tools; then
print_error "Xcode Command Line Tools are required"
exit 1
fi
print_success "Xcode Command Line Tools verified"
# Check macOS version
MACOS_VERSION=$(sw_vers -productVersion)
MACOS_MAJOR=$(echo "$MACOS_VERSION" | cut -d '.' -f 1)
print_info "macOS version: $MACOS_VERSION"
if [ "$MACOS_MAJOR" -lt 11 ]; then
print_warning "This script is optimized for macOS 11+ (Big Sur or later)"
print_warning "You're running macOS $MACOS_VERSION - some features may not work"
read -p "Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
print_info "Installation cancelled"
exit 0
fi
fi
# Check architecture
ARCH=$(uname -m)
print_info "Architecture: $ARCH"
if [[ "$ARCH" != "arm64" ]] && [[ "$ARCH" != "x86_64" ]]; then
print_error "Unsupported architecture: $ARCH"
print_error "This script supports Apple Silicon (arm64) and Intel (x86_64) only"
exit 1
fi
# Step 1: Install Homebrew
print_header "Step 1/14: Homebrew Installation"
if command -v brew &>/dev/null; then
print_success "Homebrew already installed"
BREW_VERSION=$(brew --version | head -n 1)
print_info "$BREW_VERSION"
else
print_info "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
print_success "Homebrew installed successfully"
fi
# Ensure Homebrew is available for the remaining steps
if command -v brew &>/dev/null; then
eval "$(brew shellenv)"
elif [[ "$ARCH" == "arm64" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
else
eval "$(/usr/local/bin/brew shellenv)"
fi
# Update Homebrew
print_info "Updating Homebrew..."
if retry_command 3 brew update; then
print_success "Homebrew updated"
else
print_warning "Homebrew update had issues, continuing anyway..."
fi
# Step 2: Install Claude Code
print_header "Step 2/14: Installing Claude Code CLI"
if command -v claude &>/dev/null; then
print_success "Claude Code already installed"
CLAUDE_VERSION=$(claude --version 2>&1 | head -n 1)
print_info "$CLAUDE_VERSION"
else
print_info "Installing Claude Code..."
if retry_command 3 bash -c 'curl -fsSL https://claude.ai/install.sh | bash'; then
print_success "Claude Code installed successfully"
else
print_error "Failed to install Claude Code"
print_info "Try manually: curl -fsSL https://claude.ai/install.sh | bash"
exit 1
fi
fi
# Verify claude is available
if command -v claude &>/dev/null; then
print_success "Claude Code CLI is ready"
else
print_error "Claude Code CLI not found after installation"
exit 1
fi
# Step 3: Install Homebrew Formulae
print_header "Step 3/14: Installing Homebrew Packages"
TOTAL_FORMULAE=${#FORMULAE[@]}
print_info "Installing $TOTAL_FORMULAE packages..."
echo ""
# Get list of installed formulae once (performance optimization)
INSTALLED_FORMULAE=$(brew list --formula)
CURRENT=0
for formula in "${FORMULAE[@]}"; do
((CURRENT++))
if echo "$INSTALLED_FORMULAE" | grep -q "^${formula}\$"; then
print_success "[$CURRENT/$TOTAL_FORMULAE] $formula already installed"
else
print_info "[$CURRENT/$TOTAL_FORMULAE] Installing $formula..."
brew install "$formula" || print_warning "Failed to install $formula (may already exist)"
fi
done
print_success "All formulae installed"
# Step 4: Configure GitHub CLI
print_header "Step 4/14: Configuring GitHub CLI"
if command -v gh &>/dev/null; then
print_info "Checking GitHub CLI authentication status..."
if gh auth status &>/dev/null; then
print_success "GitHub CLI already authenticated"
else
print_info "GitHub CLI needs authentication"
print_info "You'll be prompted to authenticate with GitHub..."
echo ""
if gh auth login; then
print_success "GitHub CLI authenticated successfully"
else
print_warning "GitHub CLI authentication failed or was skipped"
print_info "You can authenticate later with: gh auth login"
fi
fi
else
print_warning "GitHub CLI not found, skipping authentication"
fi
# Step 5: Install Node.js via nvm
print_header "Step 5/14: Installing Node.js (nvm)"
# Ensure nvm directory exists
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
# Check if nvm is already installed
if [ -s "$NVM_DIR/nvm.sh" ]; then
print_success "nvm already installed"
else
print_info "Installing nvm via official installation script..."
# Install nvm using the official method
NVM_VERSION="v0.40.3"
if retry_command 3 curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" | bash; then
print_success "nvm installed successfully"
else
print_error "Failed to install nvm"
print_error "Please try manually: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash"
exit 1
fi
fi
# Load nvm for this session
if [ -s "$NVM_DIR/nvm.sh" ]; then
# shellcheck disable=SC1090
. "$NVM_DIR/nvm.sh"
else
print_error "nvm initialization script not found at $NVM_DIR/nvm.sh"
exit 1
fi
print_info "Installing latest LTS release of Node.js via nvm..."
if nvm install --lts; then
print_success "Latest Node.js LTS version installed with nvm"
else
print_error "Failed to install Node.js via nvm"
exit 1
fi
if nvm alias default 'lts/*'; then
print_success "Default Node.js version set to latest LTS"
else
print_error "Failed to set default Node.js version"
exit 1
fi
if nvm use default; then
:
else
print_error "Failed to activate default Node.js version"
exit 1
fi
if command -v node &>/dev/null; then
NODE_VERSION=$(node --version 2>/dev/null || nvm current)
print_success "Node.js $NODE_VERSION active via nvm"
else
print_error "Node.js not available on PATH after nvm installation"
exit 1
fi
if nvm --version >/dev/null 2>&1; then
NVM_VERSION=$(nvm --version)
print_success "nvm $NVM_VERSION ready for use"
else
print_warning "Unable to determine nvm version"
fi
# Step 6: Install NPM Global Packages
print_header "Step 6/14: Installing NPM Global Packages"
if [ ${#NPM_PACKAGES[@]} -gt 0 ]; then
print_info "Installing ${#NPM_PACKAGES[@]} npm global packages..."
echo ""
for package in "${NPM_PACKAGES[@]}"; do
# Extract package name (without version specifiers)
package_name=$(echo "$package" | cut -d'@' -f2- | cut -d'/' -f2)
if npm list -g --depth=0 2>/dev/null | grep -q "$package_name"; then
print_success "$package already installed"
else
print_info "Installing $package..."
if npm install -g "$package"; then
print_success "$package installed successfully"
else
print_warning "Failed to install $package (may require manual installation)"
fi
fi
done
print_success "NPM global packages installation complete"
else
print_info "No NPM global packages configured"
fi
# Step 7: Install Homebrew Casks
print_header "Step 7/14: Installing Applications"
print_info "Installing ${#CASKS[@]} applications..."
echo ""
# Get list of installed casks once (performance optimization)
INSTALLED_CASKS=$(brew list --cask)
TOTAL_CASKS=${#CASKS[@]}
CURRENT=0
for cask in "${CASKS[@]}"; do
((CURRENT++))
if echo "$INSTALLED_CASKS" | grep -q "^${cask}\$"; then
print_success "[$CURRENT/$TOTAL_CASKS] $cask already installed"
else
print_info "[$CURRENT/$TOTAL_CASKS] Installing $cask..."
brew install --cask "$cask" || print_warning "Failed to install $cask (may require manual installation)"
fi
done
print_success "All applications installed"
# Step 8: Install VS Code Extensions
print_header "Step 8/14: Installing VS Code Extensions"
if command -v code &>/dev/null; then
TOTAL_EXTENSIONS=${#VSCODE_EXTENSIONS[@]}
print_info "Ensuring $TOTAL_EXTENSIONS essential VS Code extensions are installed..."
if ! installed_extensions=$(code --list-extensions 2>/dev/null); then
print_warning "Unable to list existing VS Code extensions; attempting installations anyway"
installed_extensions=""
fi
CURRENT=0
for extension in "${VSCODE_EXTENSIONS[@]}"; do
((CURRENT++))
if printf '%s\n' "$installed_extensions" | grep -Fxq "$extension"; then
print_success "[$CURRENT/$TOTAL_EXTENSIONS] $extension already installed"
continue
fi
print_info "[$CURRENT/$TOTAL_EXTENSIONS] Installing $extension..."
if code --install-extension "$extension" >/dev/null 2>&1; then
print_success "[$CURRENT/$TOTAL_EXTENSIONS] $extension installed"
else
print_warning "Failed to install $extension (it may require manual installation)"
fi
done
else
print_warning "VS Code command-line tool not found; skipping extension installation"
fi
# Step 9: Run Setup Script
print_header "Step 9/14: Configuring Shell & Terminal"
if [ -f "$SCRIPT_DIR/setup.sh" ]; then
print_info "Running setup.sh to configure shell..."
chmod +x "$SCRIPT_DIR/setup.sh"
"$SCRIPT_DIR/setup.sh"
print_success "Shell configuration complete"
else
print_warning "setup.sh not found at $SCRIPT_DIR, skipping shell configuration"
fi
# Step 10: Start PostgreSQL
print_header "Step 10/14: Starting PostgreSQL Service"
if command -v psql &>/dev/null; then
print_info "Starting PostgreSQL..."
brew services start postgresql@17
sleep 3 # Give it time to start
if brew services list | grep postgresql@17 | grep -q started; then
print_success "PostgreSQL started successfully"
print_info "PostgreSQL will now start automatically on boot"
else
print_warning "PostgreSQL may not have started correctly"
print_info "Try manually: brew services start postgresql@17"
fi
else
print_warning "PostgreSQL not found, skipping service start"
fi
# Step 11: Launch Docker
print_header "Step 11/14: Starting Docker Desktop"
if [ -d "/Applications/Docker.app" ]; then
print_info "Launching Docker Desktop..."
open -a Docker
print_success "Docker Desktop launched"
print_info "Docker is starting in the background (may take 1-2 minutes)"
print_info "Check the menu bar for the Docker icon"
else
print_warning "Docker Desktop not found"
print_info "You may need to install it manually or with admin password:"
print_info " brew install --cask docker-desktop"
fi
# Step 12: Configure MCP Servers (MCP-First Architecture)
print_header "Step 12/14: Configuring MCP Servers"
print_info "Setting up Model Context Protocol (MCP) servers for multi-agent workflow..."
print_info "Architecture: Claude Code (Orchestrator) + Gemini (Analyst) + Codex (Specialist)"
echo ""
# Configure Codex MCP server (The Specialist - Expert Generator)
# Note: codex and gemini-cli are Homebrew packages, so npx can be used directly
if command -v codex &>/dev/null; then
print_info "Configuring Codex MCP server (The Specialist)..."
if claude mcp get codex-cli -s user &>/dev/null; then
print_success "Codex MCP server already configured"
else
if claude mcp add codex-cli -s user -- npx -y codex-mcp-server; then
print_success "Codex MCP server configured"
else
print_warning "Failed to configure Codex MCP server (may need manual setup)"
print_info "Manual command: claude mcp add codex-cli -s user -- npx -y codex-mcp-server"
fi
fi
else
print_warning "Codex CLI not found"
print_info "Install with: brew install codex"
fi
# Configure Gemini MCP server (The Analyst - Deep Reader)
if command -v gemini &>/dev/null; then
print_info "Configuring Gemini MCP server (The Analyst)..."
if claude mcp get gemini-cli -s user &>/dev/null; then
print_success "Gemini MCP server already configured"
else
if claude mcp add gemini-cli -s user -- npx -y gemini-mcp-tool; then
print_success "Gemini MCP server configured"
else
print_warning "Failed to configure Gemini MCP server (may need manual setup)"
print_info "Manual command: claude mcp add gemini-cli -s user -- npx -y gemini-mcp-tool"
fi
fi
else
print_warning "Gemini CLI not found"
print_info "Install with: brew install gemini-cli"
fi
echo ""
print_info "Verifying MCP server status..."
if command -v claude &>/dev/null; then
claude mcp list 2>/dev/null || print_warning "Could not list MCP servers"
else
print_warning "Claude Code CLI not found, MCP configuration may not be available"
fi
# Step 13: Verify Installations
print_header "Step 13/14: Verifying Installations"
echo ""
print_info "Checking installed tools..."
echo ""
# Check each tool
check_tool() {
local tool=$1
local command=$2
if command -v "$command" &>/dev/null; then
local version=$($command --version 2>&1 | head -n 1)
print_success "$tool: $version"
else
print_warning "$tool: Not found or not in PATH"
fi
}
check_tool "Claude Code" "claude"
check_tool "Git" "git"
check_tool "GitHub CLI" "gh"
check_tool "Codex" "codex"
check_tool "Gemini CLI" "gemini"
check_tool "nvm" "nvm"
check_tool "Node.js" "node"
check_tool "npm" "npm"
check_tool "Python 3" "python3"
check_tool "pip" "pip3"
check_tool "PostgreSQL" "psql"
check_tool "Docker" "docker"
check_tool "VS Code" "code"
# Installation complete - no additional setup needed
# Step 14: Install Git Hooks for Auto-Update
print_header "Step 14/14: Setting Up Auto-Update System"
print_info "Installing git post-merge hook..."
# Check if we're in a git repository
if [ -d "$SCRIPT_DIR/.git" ]; then
# Install post-merge hook
HOOK_SOURCE="$SCRIPT_DIR/hooks/post-merge"
HOOK_TARGET="$SCRIPT_DIR/.git/hooks/post-merge"
if [ -f "$HOOK_SOURCE" ]; then
# Create hooks directory if it doesn't exist
mkdir -p "$SCRIPT_DIR/.git/hooks"
# Copy and make executable
cp "$HOOK_SOURCE" "$HOOK_TARGET"
chmod +x "$HOOK_TARGET"
print_success "Git post-merge hook installed"
print_info " Hook will run automatically after 'git pull'"
print_info " Detects changes and updates environment accordingly"
else
print_warning "Hook template not found at $HOOK_SOURCE"
fi
else
print_warning "Not a git repository, skipping hook installation"
fi
echo ""
print_info "Auto-update features:"
echo " • Shell configs update automatically (symlinks)"
echo " • Terminal configs update automatically (symlinks)"
echo " • Post-merge hook notifies you of important changes"
echo " • Run 'make update' to manually update everything"
echo ""
# Final Summary
print_header "Installation Complete!"
echo ""
print_success "Your development environment has been set up!"
echo ""
print_info "What was installed:"
echo " • Claude Code CLI (AI pair programmer - installed early)"
echo " • GitHub CLI with authentication (gh)"
echo " • Codex & Gemini CLI (via Homebrew)"
echo " • Ghostty (modern terminal)"
echo " • Docker Desktop (containerization)"
echo " • Visual Studio Code (code editor)"
echo " • VS Code extensions (Python, Docker, Makefile, GitLens, Copilot, Prettier, ESLint)"
echo " • PostgreSQL 17 (database, running)"
echo " • Python 3.13 (primary Python)"
echo " • Node.js LTS via nvm (JavaScript runtime)"
echo " • Codex & Gemini MCP servers (configured for Claude Code)"
echo " • 34+ supporting packages and libraries"
echo ""
print_info "Next steps:"
echo " 1. ${YELLOW}Restart your terminal${NC} to load all configurations"
echo " 2. Verify Docker is running (check menu bar icon)"
echo " 3. Test your setup:"
echo " claude --version"
echo " gh --version"
echo " codex --version"
echo " gemini --version"
echo " docker --version"
echo " code --version"
echo " psql --version"
echo " python3 --version"
echo " nvm --version"
echo " node --version"
echo ""
print_info "Documentation:"
echo " • README.md - Complete guide and reference"
echo " • PRE-INSTALLATION-CHECKLIST.md - Pre-installation steps"
echo ""
print_success "Happy coding! 🚀"
echo ""
# Check if we need to restart
if [[ "$SHELL" == */zsh ]]; then
print_warning "Please restart your terminal for all changes to take effect"
echo ""
read -r -p "Press ENTER to finish..."
fi