-
Notifications
You must be signed in to change notification settings - Fork 1
/
osx_bootstrap.sh
executable file
·128 lines (108 loc) · 3.4 KB
/
osx_bootstrap.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
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
# inspired by
# https://gist.github.com/codeinthehole/26b37efa67041e1307db
# https://github.com/why-jay/osx-init/blob/master/install.sh
# https://github.com/timsutton/osx-vm-templates/blob/master/scripts/xcode-cli-tools.sh
# PRECONDITIONS
# 1)
# make sure the file is executable
# chmod +x osx_bootstrap.sh
#
# 2)
# Your password may be necessary for some packages
#
# 3)
# https://docs.brew.sh/Installation#macos-requirements
# xcode-select --install
# (_xcode-select installation_ installs git already, however git will be installed via brew packages as well to install as much as possible the brew way
# this way you benefit from frequent brew updates)
#
# 4) don't let the “Operation not permitted” error bite you
# Please make sure you system settings allow the termianl full disk access
# https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/
# `set -eu` causes an 'unbound variable' error in case SUDO_USER is not set
SUDO_USER=$(whoami)
# Check for Homebrew, install if not installed
if test ! $(which brew); then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew update
brew upgrade
# find the CLI Tools update
echo "find CLI tools update"
PROD=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n') || true
# install it
if [[ ! -z "$PROD" ]]; then
softwareupdate -i "$PROD" --verbose
fi
PACKAGES=(
node
docker
git
cocoapods
gh
grep
tree
jq
flutter
starship
ag
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
CASKS=(
alfred
figma
iterm2
visual-studio-code
microsoft-teams
microsoft-edge
google-chrome
slack
ngrok
insomnia
spotify
rocket
vlc
)
echo "Installing cask apps..."
sudo -u $SUDO_USER brew install --cask ${CASKS[@]}
echo "Install Nerd Font Fira Code"
brew tap homebrew/cask-fonts
brew install --cask font-fira-code-nerd-font
echo "Installing finder improvements"
brew install --cask qlcolorcode qlimagesize qlmarkdown qlvideo quicklook-csv quicklook-json
brew install --cask suspicious-package
# Check for ohmyzsh, install if not installed
if test ! $(which zsh); then
echo "Installing ohmyzsh..."
/bin/bash -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
echo "Installing additional zsh plugins"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
echo "Installing global npm packages..."
sudo -u $SUDO_USER npm install pnpm -g
echo "Installing mac store app installer"
brew install mas
echo "Installing mac store apps"
# Amphetamine
mas install 937984704
# Magnet
mas install 441258766
# Xcode
mas install 497799835
# Remote Desktop
mas install 1295203466
echo "Cleaning up"
brew cleanup
echo "Ask the doctor"
brew doctor
echo "osx bootstrapping done"
# please see also the accompanying blog post
# https://www.lotharschulz.info/2021/05/11/macos-setup-automation-with-homebrew/