-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
196 lines (149 loc) · 7.05 KB
/
install.sh
File metadata and controls
196 lines (149 loc) · 7.05 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
#! /bin/sh
source ./util.sh
source ./config.sh
bot "Hi! I'm going to install tooling and tweak your system settings. Here I go..."
# ###############################################################################
# # sudo
# ###############################################################################
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# ###############################################################################
# # Git config
# ###############################################################################
bot "OK, now I am going to update the .gitconfig for your user info:"
read -r -p "What is your git username? " username
read -r -p "What is your email? " email
read -r -p "What is your dotfile repository url (exp: git@github.com:username/dotfiles.git)? " dotfile
# ###############################################################################
# # Generating a new SSH key
# ###############################################################################
ssh-keygen -o -a 100 -t ed25519 -C $email
eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub | pbcopy
bot "Go to https://github.com/settings/ssh"
read -p "SSH public key was copied to the clipboard. Please add it to github and press ENTER to continue..."
# # ###########################################################
# # Install XCode Dev Tools
# # ###########################################################
bot "ensuring build/install tools are available"
xcode-select --install 2>&1 > /dev/null
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer 2>&1 > /dev/null
sudo xcodebuild -license accept 2>&1 > /dev/null
# ###############################################################################
# # Install HomeBrew and Cask
# ###############################################################################
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
bot "Installing GNU core utils (those that come with OS X are outdated)..."
brew install coreutils
bot "Adding nightly/beta Cask versions..."
brew tap homebrew/cask-versions
###############################################################################
# Install binaries
###############################################################################
bot "Installing binaries..."
brew install ${binaries[@]}
# ###############################################################################
# # Install apps
# ###############################################################################
bot "Installing apps to /Applications..."
brew install --cask ${apps[@]}
# ###############################################################################
# # Git config
# ###############################################################################
running "replacing items in .gitconfig with your info ($username $email)"
cp config/gitconfig ~/.gitconfig
git config --global user.name $username
git config --global user.email $email
###############################################################################
# Install oh-my-zsh
###############################################################################
bot "setting zsh (/usr/local/bin/zsh) as your shell (password required)"
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sed '/\s*env\s\s*zsh\s*/d')"
mkdir -p ~/.oh-my-zsh/plugins/zsh-autosuggestions
git clone git://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
###############################################################################
# Install and configure Starship prompt
###############################################################################
bot "Installing Starship prompt..."
# Starship is installed via Homebrew in the binaries section
# Initialize Starship in .zshrc (will be overridden by dotfiles if present)
if ! grep -q 'eval "$(starship init zsh)"' ~/.zshrc 2>/dev/null; then
echo '' >> ~/.zshrc
echo '# Initialize Starship prompt' >> ~/.zshrc
echo 'eval "$(starship init zsh)"' >> ~/.zshrc
ok "Starship initialization added to .zshrc"
else
ok "Starship already configured in .zshrc"
fi
###############################################################################
# Dotfiles Setup
###############################################################################
if [[ -n ${dotfile} ]];
then
git clone $dotfile ~/.dotfiles
bot "creating symlinks for dotfiles..."
rcup -v
else
bot "no dotfiles for you :/"
fi
# ###############################################################################
# # Install Fonts
# ###############################################################################
bot "installing fonts"
brew install fontconfig
brew tap homebrew/cask-fonts
brew install ${fonts[@]}
###############################################################################
# Installing global node packages with fnm
###############################################################################
bot "Installing global node packages with fnm..."
# fnm is installed via Homebrew in the binaries section
# Setup fnm environment
eval "$(fnm env --use-on-cd)"
# Install latest LTS Node.js version
fnm install --lts
ok "Node.js LTS installed via fnm"
# Install global npm packages
if [ ${#node_packages[@]} -gt 0 ]; then
npm install -g ${node_packages[@]}
ok "Global npm packages installed"
fi
# Add fnm initialization to .zshrc if not present
if ! grep -q 'fnm env' ~/.zshrc 2>/dev/null; then
echo '' >> ~/.zshrc
echo '# Initialize fnm (Fast Node Manager)' >> ~/.zshrc
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.zshrc
ok "fnm initialization added to .zshrc"
fi
brew cleanup
###############################################################################
# Installing VScode extensions
###############################################################################
bot "Installing vscode extensions..."
for element in "${vscode_extensions[@]}"
do
code --install-extension $element
done
###############################################################################
# Setup Colima (Docker Desktop replacement)
###############################################################################
bot "Setting up Colima..."
# Colima, docker, and docker-compose are installed via Homebrew in the binaries section
# Start Colima with reasonable defaults (4 CPUs, 8GB RAM, 100GB disk)
colima start --cpu 4 --memory 8 --disk 100 --arch $(uname -m) 2>/dev/null || {
warn "Colima may already be running or needs manual configuration"
}
# Verify Docker is working
if docker ps > /dev/null 2>&1; then
ok "Docker is running via Colima"
else
warn "Colima setup may need manual configuration. Run 'colima start' after installation."
fi
###############################################################################
# Setup OS X defaults and other useful tweaks.
###############################################################################
source ./osx-settings.sh