-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·74 lines (56 loc) · 2.16 KB
/
setup
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
#!/usr/bin/env bash
# exit immediately if a pipeline exits with a non-zero status
set -Eeuxo pipefail
ARCH=$(uname -m)
SCRIPT_DIR="$(cd "$(dirname "$0")" &> /dev/null && pwd)"
# TODO: use "associative array" when Bash 4 comes to macOS
LINKING_MAP=(
"$SCRIPT_DIR/.gitconfig:$HOME/.gitconfig"
"$SCRIPT_DIR/.gitmessage:$HOME/.gitmessage"
"$SCRIPT_DIR/.npmrc:$HOME/.npmrc"
"$SCRIPT_DIR/.config/fish/config.fish:$HOME/.config/fish/config.fish"
"$SCRIPT_DIR/.config/fish/functions:$HOME/.config/fish"
"$SCRIPT_DIR/.config/starship.toml:$HOME/.config/starship.toml"
"$SCRIPT_DIR/.vscode/settings.json:$HOME/Library/Application Support/Code/User/settings.json"
"$SCRIPT_DIR/.vscode/global.code-snippets:$HOME/Library/Application Support/Code/User/snippets/global.code-snippets"
)
# print macOS version information
sw_vers
if [[ "${CI:-false}" != "true" ]]; then
# accept XCode license
sudo xcodebuild -license accept
# install Apple's Command Line Tools
# ignore "already installed" error if it appears
xcode-select --install || true
# Install all available software updates (OS, Safari, security etc.)
softwareupdate --install --all --agree-to-license --verbose
fi
if [[ $ARCH == "arm64" ]]; then
# Install Rosetta 2 (only for Apple Silicon)
softwareupdate --install-rosetta --agree-to-license --verbose
fi
# install Fish shell
"$SCRIPT_DIR/scripts/install-fish.sh"
# install Starship prompt
"$SCRIPT_DIR/scripts/install-starship.sh"
# install Node.js
"$SCRIPT_DIR/scripts/install-nodejs.sh"
# install fonts
"$SCRIPT_DIR/scripts/install-fonts.sh"
# install Visual Studio Code
"$SCRIPT_DIR/scripts/install-vscode.sh"
# install Docker Desktop
"$SCRIPT_DIR/scripts/install-docker.sh"
# install AWS CLI
"$SCRIPT_DIR/scripts/install-aws-cli.sh"
# create directories if they don't exist
mkdir -p -v "$HOME/.config/fish"
mkdir -p -v "$HOME/Library/Application Support/Code/User/snippets"
# create symbolic links to file and directories in the .dotfiles
for LINK in "${LINKING_MAP[@]}"; do
SOURCE="${LINK%%:*}"
DESTINATION="${LINK##*:}"
ln -f -s -v "$SOURCE" "$DESTINATION"
done
# install Visual Studio Code extensions
"$SCRIPT_DIR/scripts/install-vscode-extensions.sh"