-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·142 lines (113 loc) · 3.73 KB
/
bootstrap.sh
File metadata and controls
executable file
·142 lines (113 loc) · 3.73 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
#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# Print with color
print_status() {
echo -e "${GREEN}==>${NC} $1"
}
print_error() {
echo -e "${RED}==>${NC} $1"
}
# Check if Homebrew is installed, install if not
install_homebrew() {
if ! command -v brew &> /dev/null; then
print_status "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo >> /Users/yn5/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/yn5/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
else
print_status "Homebrew already installed"
fi
}
# Install dependencies using Homebrew
install_dependencies() {
print_status "Installing dependencies..."
brew update
# Install all required applications
brew install git
brew install neovim
brew install nvm
brew install uv
brew install tmux
brew install zsh
brew install tree
brew install diff-so-fancy
brew install --cask docker-desktop
brew install --cask ghostty
brew install --cask visual-studio-code
# Install Dark Notify (for automatic dark mode in tmux and neovim)
brew install cormacrelf/tap/dark-notify
# Install Oh My Zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
}
# Create necessary directories
create_directories() {
print_status "Creating config directories..."
mkdir -p ~/.claude
mkdir -p ~/.config/ghostty
mkdir -p ~/.config/git
mkdir -p ~/.config/tmux
mkdir -p "$HOME/Library/Application Support/Code/User"
}
# Create symlinks
create_symlinks() {
print_status "Creating symlinks..."
# Ghostty
ln -sf ~/.dotfiles/claude/settings.json.symlink ~/.claude/settings.json
# Ghostty
ln -sf ~/.dotfiles/ghostty/config.symlink ~/.config/ghostty/config
# Git
ln -sf ~/.dotfiles/git/config.symlink ~/.config/git/config
ln -sf ~/.dotfiles/git/ignore.symlink ~/.config/git/ignore
# Neovim
ln -sfn ~/.dotfiles/nvim.symlink ~/.config/nvim
# Tmux
ln -sf ~/.dotfiles/tmux/tmux.conf.symlink ~/.config/tmux/tmux.conf
# VS Code
ln -sf ~/.dotfiles/vscode/settings.json.symlink "$HOME/Library/Application Support/Code/User/settings.json"
ln -sf ~/.dotfiles/vscode/keybindings.json.symlink "$HOME/Library/Application Support/Code/User/keybindings.json"
# Zsh
ln -sf ~/.dotfiles/zsh/zshrc.symlink ~/.zshrc
}
# Install VS Code extensions
install_vscode_extensions() {
print_status "Installing VS Code extensions..."
if ! command -v code &> /dev/null; then
print_error "VS Code CLI not found, skipping extensions"
return
fi
while IFS= read -r extension; do
code --install-extension "$extension" --force
done < ~/.dotfiles/vscode/extensions.txt
}
# Set configuration paramters
configure() {
# Enable key repeat of the symbol menu. Requires logout and login to take effect.
defaults write -g ApplePressAndHoldEnabled -bool false
}
main() {
# Check if running on MacOS
if [[ "$OSTYPE" != "darwin"* ]]; then
print_error "This script is intended for MacOS only"
exit 1
fi
# Check if dotfiles are in the correct location
if [ ! -d "$HOME/.dotfiles" ]; then
print_error "Please clone the dotfiles repository to ~/.dotfiles first"
exit 1
fi
install_homebrew
install_dependencies
create_directories
create_symlinks
install_vscode_extensions
configure
print_status "Bootstrap complete! Please restart your terminal."
}
# Run the script
main