-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-macos.sh
More file actions
executable file
·185 lines (159 loc) · 6.06 KB
/
install-macos.sh
File metadata and controls
executable file
·185 lines (159 loc) · 6.06 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
#!/bin/bash
# macOS Dotfiles installer
# Usage: ./install-macos.sh
set -e
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "=== Installing dotfiles (macOS) ==="
# Step 1: Check for Homebrew
if ! command -v brew &> /dev/null; then
echo ""
echo "Step 1: Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo ""
echo "Step 1: Homebrew already installed"
fi
# Step 2: Install packages
echo ""
echo "Step 2: Installing packages..."
brew install stow mise starship protobuf bufbuild/buf/buf kind istioctl
# Shell and tools
brew install nushell atuin zoxide
# TTS for Claude Code hooks (piper via pip)
pip3 install piper-tts
# Symlink piper to /usr/local/bin (pip installs to user site-packages bin)
PIPER_BIN=$(python3 -m site --user-base)/bin/piper
if [ -f "$PIPER_BIN" ]; then
sudo ln -sf "$PIPER_BIN" /usr/local/bin/piper
fi
# Install casks (skip if already installed)
brew install --cask visual-studio-code 2>/dev/null || true
brew install --cask ghostty 2>/dev/null || true
# Claude Code via npm (or brew if available)
if ! command -v claude &> /dev/null; then
echo "Installing Claude Code..."
npm install -g @anthropic-ai/claude-code 2>/dev/null || echo "Note: Install Claude Code manually if npm not available"
fi
# Step 3: Stow cross-platform configs
echo ""
echo "Step 3: Stowing config files..."
cd "$DOTFILES_DIR"
# These packages use ~/.config/ which works on macOS
packages=(claude mise starship nushell)
for package in "${packages[@]}"; do
if [ -d "$package" ]; then
echo " Stowing $package..."
stow -D --target="$HOME" "$package" 2>/dev/null || true
stow -v --ignore='setup\.sh' --target="$HOME" "$package"
fi
done
# Nushell uses ~/Library/Application Support/nushell/ by default on macOS
# Create symlinks to XDG location for cross-platform config
echo " Linking nushell config for macOS..."
mkdir -p "$HOME/Library/Application Support/nushell"
ln -sf "$HOME/.config/nushell/env.nu" "$HOME/Library/Application Support/nushell/env.nu"
ln -sf "$HOME/.config/nushell/config.nu" "$HOME/Library/Application Support/nushell/config.nu"
# Step 4: Setup mise runtimes (after config is stowed)
echo ""
echo "Step 4: Setting up mise..."
if [ -f "$DOTFILES_DIR/mise/setup.sh" ]; then
"$DOTFILES_DIR/mise/setup.sh"
fi
# Step 4a: Setup Claude Code MCP servers
echo ""
echo "Step 4a: Setting up Claude Code MCP servers..."
if [ -f "$DOTFILES_DIR/claude/setup-mcp.sh" ]; then
"$DOTFILES_DIR/claude/setup-mcp.sh"
fi
# Step 5: Setup VS Code (different path on macOS)
echo ""
echo "Step 5: Setting up VS Code..."
VSCODE_USER_DIR="$HOME/Library/Application Support/Code/User"
if [ -d "$VSCODE_USER_DIR" ] || mkdir -p "$VSCODE_USER_DIR"; then
# Symlink settings
for file in settings.json keybindings.json; do
src="$DOTFILES_DIR/vscode/.config/Code/User/$file"
dest="$VSCODE_USER_DIR/$file"
if [ -f "$src" ]; then
rm -f "$dest"
ln -sv "$src" "$dest"
fi
done
# Symlink snippets directory
if [ -d "$DOTFILES_DIR/vscode/.config/Code/User/snippets" ]; then
rm -rf "$VSCODE_USER_DIR/snippets"
ln -sv "$DOTFILES_DIR/vscode/.config/Code/User/snippets" "$VSCODE_USER_DIR/snippets"
fi
fi
# Install VS Code extensions
echo "Installing VS Code extensions..."
install_ext() {
code --uninstall-extension "$1" 2>/dev/null || true
code --install-extension "$1" || true
}
install_ext enkia.tokyo-night
install_ext subframe7536.custom-ui-style
install_ext golang.go
install_ext ms-python.python
install_ext dbaeumer.vscode-eslint
install_ext prettier.prettier-vscode
install_ext ms-azuretools.vscode-docker
install_ext ms-vscode-remote.remote-containers
# Copy custom extensions
if [ -d "$DOTFILES_DIR/vscode/extensions" ]; then
echo "Installing custom VS Code extensions..."
mkdir -p "$HOME/.vscode/extensions"
cp -r "$DOTFILES_DIR/vscode/extensions"/* "$HOME/.vscode/extensions/"
fi
# Step 6: Setup piper-speak (TTS for Claude Code hooks)
echo ""
echo "Step 6: Setting up piper-speak..."
export PATH="$HOME/.local/share/mise/shims:$PATH"
PIPER_SPEAK_DIR="$HOME/Developer/piper-speak"
if [ -d "$PIPER_SPEAK_DIR" ]; then
cd "$PIPER_SPEAK_DIR"
go build -o piper-speak ./cmd/piper-speak/
sudo install -m755 piper-speak /usr/local/bin/piper-speak
sudo install -m755 scripts/speak-selection-macos /usr/local/bin/speak-selection-macos
# Install speak-claude scripts from dotfiles bin
for script in speak-claude-permission speak-claude-question speak-claude-response; do
if [ -f "$DOTFILES_DIR/bin/.local/bin/$script" ]; then
sudo install -m755 "$DOTFILES_DIR/bin/.local/bin/$script" /usr/local/bin/
fi
done
# Download voice model if not present
VOICE_DIR="$HOME/.local/share/piper/voices"
if [ ! -f "$VOICE_DIR/en_US-lessac-medium.onnx" ]; then
echo " Downloading voice model..."
mkdir -p "$VOICE_DIR"
curl -L "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx" \
-o "$VOICE_DIR/en_US-lessac-medium.onnx"
curl -L "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json" \
-o "$VOICE_DIR/en_US-lessac-medium.onnx.json"
fi
cd "$DOTFILES_DIR"
else
echo " Skipping - clone piper-speak to ~/Developer/piper-speak first"
fi
# Step 7: Set nushell as default shell
echo ""
echo "Step 7: Setting default shell..."
NU_PATH=$(which nu)
if [ -n "$NU_PATH" ]; then
if ! grep -q "$NU_PATH" /etc/shells; then
echo " Adding nushell to /etc/shells..."
echo "$NU_PATH" | sudo tee -a /etc/shells
fi
if [ "$SHELL" != "$NU_PATH" ]; then
echo " Setting nushell as default shell..."
chsh -s "$NU_PATH"
else
echo " Nushell already default shell"
fi
fi
echo ""
echo "=== Done! ==="
echo ""
echo "Notes:"
echo " - VS Code custom-ui-style may need manual permission granting"
echo " - Restart your terminal or run 'nu' to start using nushell"