-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·115 lines (106 loc) · 3.49 KB
/
install.sh
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
#!/usr/bin/env bash
set -Eeuo pipefail
dotfiles_repo=https://github.com/roberthamel/dotfiles-macos.git
file_marker="$HOME/.local/macos-configured"
did_install_dotfiles=false
dotfiles() {
echo "🍔 dotfiles"
if [ ! -d "$HOME/.local/share/chezmoi" ]; then
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply $dotfiles_repo
did_install_dotfiles=true
echo "✅ Configured dotfiles"
else
echo "ℹ️ Skipping dotfiles configuration"
fi
}
brewsetup() {
if ! command -v brew &>/dev/null; then
echo "🍔 Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install mas
echo "✅ Installed Homebrew"
else
echo "ℹ️ Skipping Homebrew installation"
fi
}
devbox() {
if ! command -v devbox &>/dev/null; then
echo "🍔 devbox"
curl -fsSL https://get.jetify.com/devbox | bash
echo "✅ Installed devbox"
else
echo "ℹ️ Skipping devbox installation"
fi
}
omz() {
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "🍔 oh-my-zsh"
export SHELL=/opt/homebrew/bin/zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo "✅ Installed oh-my-zsh"
else
echo "ℹ️ Skipping oh-my-zsh installation"
fi
}
brewinstall() {
if [ ! -e "$HOME/.Brewfile.lock.json" ]; then
echo "🍔 Install from Brewfile"
brew bundle install --global --force
echo "✅ Installed from Brewfile"
else
echo "ℹ️ Skipping Brewfile installation"
fi
}
system() {
if [ ! -e "$file_marker" ]; then
echo "🍔 MacOS"
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Increase window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# Finder: disable window animations and Get Info animations
defaults write com.apple.finder DisableAllAnimations -bool true
# Finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Show the ~/Library folder
chflags nohidden $HOME/Library
# Wipe all (default) app icons from the Dock
# This is only really useful when setting up a new Mac, or if you don’t use
# the Dock to launch apps.
defaults write com.apple.dock persistent-apps -array
# Show only open applications in the Dock
defaults write com.apple.dock static-only -bool true
# Remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-delay -float 0
# Remove the animation when hiding/showing the Dock
defaults write com.apple.dock autohide-time-modifier -float 0
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Don’t display the annoying prompt when quitting iterm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
# Save a file to mark that this process has been completed successfully at least once
touch $file_marker
else
echo "ℹ️ Skipping MacOS configuration"
fi
}
main() {
dotfiles
brewsetup
brewinstall
devbox
omz
system
}
start_time=$(date +%s)
main
end_time=$(date +%s)
elapsed_time=$(($end_time - $start_time))
minutes=$(($elapsed_time / 60))
seconds=$(($elapsed_time % 60))
echo "Elapsed time: $minutes minute(s) $seconds second(s)"
echo "exit $?"