-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·247 lines (207 loc) · 8.24 KB
/
setup.sh
File metadata and controls
executable file
·247 lines (207 loc) · 8.24 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
#!/bin/bash
# =============================================================================
# Machine Setup Script — Lucas Rowe
# Run: chmod +x setup.sh && ./setup.sh
#
# This script is idempotent — safe to run multiple times.
# For AI assistants: you can also execute each section individually
# by following SETUP.md step-by-step.
# =============================================================================
set -e # Exit on error
CONFIGS_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "📂 Configurations directory: $CONFIGS_DIR"
# ---------------------------------------------------------------------------
# Step 0: Gather user input
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 0: Configuration ==="
if [ -z "$(git config --global user.email)" ]; then
read -p "Git email address: " GIT_EMAIL
git config --global user.email "$GIT_EMAIL"
fi
if [ -z "$(git config --global user.name)" ]; then
git config --global user.name "Lucas Rowe"
fi
echo "Git identity: $(git config --global user.name) <$(git config --global user.email)>"
# ---------------------------------------------------------------------------
# Step 1: Homebrew
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 1: Homebrew ==="
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "Homebrew already installed. Updating..."
brew update
fi
# ---------------------------------------------------------------------------
# Step 2: Brewfile
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 2: Installing packages and apps ==="
brew bundle --file="$CONFIGS_DIR/Brewfile"
# IDE — ask user
echo ""
echo "Which IDE(s) would you like to install?"
echo " 1) VS Code"
echo " 2) Cursor"
echo " 3) Zed"
echo " 4) None / I'll install later"
read -p "Enter numbers separated by spaces (e.g., '1 2'): " IDE_CHOICES
for choice in $IDE_CHOICES; do
case $choice in
1) brew install --cask visual-studio-code 2>/dev/null || true ;;
2) brew install --cask cursor 2>/dev/null || true ;;
3) brew install --cask zed 2>/dev/null || true ;;
4) echo "Skipping IDE installation." ;;
esac
done
# Optional apps
echo ""
echo "Which optional apps would you like to install?"
echo " 1) Slack"
echo " 2) Figma"
echo " 3) Linear"
echo " 4) Microsoft Teams"
echo " 5) None"
read -p "Enter numbers separated by spaces (e.g., '1 2 3'): " APP_CHOICES
for choice in $APP_CHOICES; do
case $choice in
1) brew install --cask slack 2>/dev/null || true ;;
2) brew install --cask figma 2>/dev/null || true ;;
3) brew install --cask linear-linear 2>/dev/null || true ;;
4) brew install --cask microsoft-teams 2>/dev/null || true ;;
5) echo "Skipping optional apps." ;;
esac
done
# ---------------------------------------------------------------------------
# Step 3: Git config
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 3: Git configuration ==="
# Save identity before symlinking
GIT_NAME="$(git config --global user.name)"
GIT_EMAIL="$(git config --global user.email)"
# Symlink gitconfig (aliases, LFS, editor, etc.)
ln -sf "$CONFIGS_DIR/.gitconfig" ~/.gitconfig
# Re-apply identity on top of symlinked file
git config --global user.name "$GIT_NAME"
git config --global user.email "$GIT_EMAIL"
echo "Git configured: $GIT_NAME <$GIT_EMAIL>"
# ---------------------------------------------------------------------------
# Step 4: Shell (Zsh + Oh My Zsh)
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 4: Shell setup ==="
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
# Plugins
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
fi
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
fi
# Symlink .zshrc
ln -sf "$CONFIGS_DIR/.zshrc" ~/.zshrc
echo "Shell configured."
# ---------------------------------------------------------------------------
# Step 5: Node.js (via nvm)
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 5: Node.js ==="
export NVM_DIR="$HOME/.nvm"
mkdir -p "$NVM_DIR"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
if command -v nvm &>/dev/null; then
nvm install --lts
nvm use --lts
echo "Node.js $(node --version) installed."
else
echo "⚠️ nvm not available yet. Restart terminal and run: nvm install --lts"
fi
# ---------------------------------------------------------------------------
# Step 6: Python (via pyenv)
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 6: Python ==="
if command -v pyenv &>/dev/null; then
PYTHON_VERSION="3.12"
if ! pyenv versions | grep -q "$PYTHON_VERSION"; then
pyenv install "$PYTHON_VERSION"
fi
pyenv global "$PYTHON_VERSION"
echo "Python $(python3 --version) configured."
else
echo "⚠️ pyenv not available yet. Restart terminal and run: pyenv install 3.12 && pyenv global 3.12"
fi
# ---------------------------------------------------------------------------
# Step 7: Claude Code
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 7: Claude Code ==="
if ! command -v claude &>/dev/null; then
npm install -g @anthropic-ai/claude-code
echo "Claude Code installed: $(claude --version)"
else
echo "Claude Code already installed: $(claude --version)"
fi
# ---------------------------------------------------------------------------
# Step 8: Karabiner Elements
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 8: Karabiner Elements ==="
mkdir -p ~/.config/karabiner
ln -sf "$CONFIGS_DIR/karabiner.json" ~/.config/karabiner/karabiner.json
echo "Karabiner configured."
# ---------------------------------------------------------------------------
# Step 9: macOS Defaults
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 9: macOS system preferences ==="
if [ -f "$CONFIGS_DIR/macos-defaults.sh" ]; then
chmod +x "$CONFIGS_DIR/macos-defaults.sh"
"$CONFIGS_DIR/macos-defaults.sh"
fi
# ---------------------------------------------------------------------------
# Step 10: Login Items
# ---------------------------------------------------------------------------
echo ""
echo "=== Step 10: Login items ==="
LOGIN_APPS=(
"Rectangle"
"1Password"
"Alfred 5"
"CleanShot X"
)
for app in "${LOGIN_APPS[@]}"; do
if [ -d "/Applications/${app}.app" ]; then
osascript -e "tell application \"System Events\" to make login item at end with properties {path:\"/Applications/${app}.app\", hidden:false}" 2>/dev/null || true
echo "${app} added to login items."
else
echo "${app} not installed — skipping login item."
fi
done
# ---------------------------------------------------------------------------
# Done
# ---------------------------------------------------------------------------
echo ""
echo "============================================"
echo "✅ Setup complete!"
echo "============================================"
echo ""
echo "Manual steps remaining:"
echo " 1. Sign into apps: 1Password, Arc, and any optional apps you installed"
echo " 2. Set up SSH keys if not already done: gh auth login (select SSH)"
echo " 3. Set terminal font: iTerm2 → Settings → Profiles → Text → Font → FiraCode Nerd Font"
echo " 4. Set default browser: System Settings → Desktop & Dock"
echo " 5. Restart your terminal to load all changes"
echo ""
echo "Verify with:"
echo " brew --version && git --version && node --version && python3 --version && claude --version"