-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup
executable file
·143 lines (113 loc) · 4.22 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
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
#!/usr/bin/env zsh
# Install homebrew
echo "\n🍺 \033[1mInstalling Homebrew…\033[0m";
echo "(that's a package manager for macOS)\n";
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
# First check OS.
OS="$(uname)"
if [[ "${OS}" == "Linux" ]]
then
HOMEBREW_ON_LINUX=1
elif [[ "${OS}" == "Darwin" ]]
then
HOMEBREW_ON_MACOS=1
else
abort "Homebrew is only supported on macOS and Linux."
fi
# Required installation paths.
case "${SHELL}" in
*/bash*)
if [[ -r "${HOME}/.bash_profile" ]]
then
shell_profile="${HOME}/.bash_profile"
else
shell_profile="${HOME}/.profile"
fi
;;
*/zsh*)
shell_profile="${HOME}/.zprofile"
;;
*)
shell_profile="${HOME}/.profile"
;;
esac
if [[ -n "${HOMEBREW_ON_MACOS-}" ]]
then
UNAME_MACHINE="$(/usr/bin/uname -m)"
if [[ "${UNAME_MACHINE}" == "arm64" ]]
then
# On ARM macOS, this script installs to /opt/homebrew only
HOMEBREW_PREFIX="/opt/homebrew"
HOMEBREW_REPOSITORY="${HOMEBREW_PREFIX}"
else
# On Intel macOS, this script installs to /usr/local only
HOMEBREW_PREFIX="/usr/local"
HOMEBREW_REPOSITORY="${HOMEBREW_PREFIX}/Homebrew"
fi
HOMEBREW_CACHE="${HOME}/Library/Caches/Homebrew"
STAT_PRINTF=("stat" "-f")
PERMISSION_FORMAT="%A"
CHOWN=("/usr/sbin/chown")
CHGRP=("/usr/bin/chgrp")
GROUP="admin"
TOUCH=("/usr/bin/touch")
INSTALL=("/usr/bin/install" -d -o "root" -g "wheel" -m "0755")
else
UNAME_MACHINE="$(uname -m)"
# On Linux, this script installs to /home/linuxbrew/.linuxbrew only
HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
HOMEBREW_REPOSITORY="${HOMEBREW_PREFIX}/Homebrew"
HOMEBREW_CACHE="${HOME}/.cache/Homebrew"
STAT_PRINTF=("stat" "--printf")
PERMISSION_FORMAT="%a"
CHOWN=("/bin/chown")
CHGRP=("/bin/chgrp")
GROUP="$(id -gn)"
TOUCH=("/bin/touch")
INSTALL=("/usr/bin/install" -d -o "${USER}" -g "${GROUP}" -m "0755")
fi
# run the last three required steps from the brew installation script
echo "Running the three lines requested above automatically"
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> ${shell_profile}
echo eval "\"\$(${HOMEBREW_PREFIX}/bin/brew shellenv)"\" >> ${shell_profile}
eval "$(${HOMEBREW_PREFIX}/bin/brew shellenv)"
echo "Done!"
# Install common tools
echo "\n💻 \033[1mInstalling Command Line Tools…\033[0m";
echo "(using the Homebrew package manager)\n";
for x in gh git antigen zsh-completions tree fnm; do brew install $x; done;
brew install fzf && $(brew --prefix)/opt/fzf/install;
echo "Installed command line tools:" && brew list --formulae -1;
# Install macOS apps
echo "\n🖱 \033[1mInstalling macOS Apps…\033[0m";
echo "(using the Homebrew package manager)\n";
brew tap homebrew/cask-versions;
for x in iterm2 visual-studio-code rectangle quicklook-json; do brew install --cask $x; done;
brew install --cask firefox-developer-edition --lang=en-US;
echo "Installed macOS apps:" && brew list --cask -1;
# Set up node lts
echo "\n⬢ \033[1mInstalling Node LTS…\033[0m";
echo "(Node is a JavaScript runtime used for local development)\n";
eval "$(fnm env)";
fnm install lts-latest;
fnm alias lts-latest default;
fnm use default;
echo "Installed Node Version:";
node -v;
# install global node packages
echo "\n⬢ \033[1mInstalling Global Node Modules…\033[0m";
echo "(using npm)\n";
npm i -g eslint@8
echo "Installed global node modules:" && npm list -g --depth=0;
# configurations
echo "\n⚙️ \033[1mInstalling configurations…\033[0m";
echo "(These set up your command line to work and look nicer)\n";
# iTerm shell integration
curl -L https://iterm2.com/shell_integration/install_shell_integration_and_utilities.sh | bash
# Copy configuration files
sudo curl -s https://raw.githubusercontent.com/neuefische/web-setup/main/configs/.zshrc > ~/.zshrc;
curl -s https://raw.githubusercontent.com/neuefische/web-setup/main/configs/.p10k.zsh > ~/.p10k.zsh;
echo "\n✨ \033[1m…all done!\033[0m";
echo "You can now switch to the iTerm Terminal by pressing \033[1m⌘\033[0m + \033[1mSpace\033[0m and search for \"iTerm\".\n";
echo "We have some suggestions for nicer macOS settings which you can apply by running:";
echo "\033[0;36mzsh <(curl -s https://raw.githubusercontent.com/neuefische/web-setup/main/setup-macos)\033[0m\n";