-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_once_before_install-darwin.sh.tmpl
executable file
·56 lines (45 loc) · 1.57 KB
/
run_once_before_install-darwin.sh.tmpl
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
{{- if eq .chezmoi.os "darwin" -}}
#!/bin/bash
# Ensure that we are in the dotfiles directory.
cd "{{ .chezmoi.sourceDir }}"
DOTFILES_ROOT=$(pwd)
set -eo pipefail
. "{{ .chezmoi.sourceDir }}/script-helpers.sh"
# Ensure that Homebrew doesn't send analytics during install.
export HOMEBREW_NO_ANALYTICS=1
# Don't show environment hints during install.
export HOMEBREW_NO_ENV_HINTS=1
# The bootstrap script also installs Homebrew, but we check again here
# in case the bootstrap scipt wasn't used.
if ! is_command brew; then
info "Installing Homebrew..."
stay_awake_while /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Check the location of the `brew` command because install path is
# different for Apple Silicon.
BREW_COMMAND=/usr/local/bin/brew
if ! is_command $BREW_COMMAND; then
BREW_COMMAND=/opt/homebrew/bin/brew
fi
# Make sure Homebrew is in the path.
eval "$($BREW_COMMAND shellenv)"
else
info "Homebrew is already installed."
fi
info "Installing or updating Homebrew packages..."
brew tap homebrew/bundle
quietly_brew_bundle Brewfile --verbose
# Brewfile.casks exits 1 sometimes but didn't actually fail
quietly_brew_bundle Brewfile.casks || true
if ! echo "$SHELL" | grep -Fq zsh; then
info "Changing default shell to Zsh..."
execute chsh -s /bin/zsh
fi
info "Updating macOS system settings..."
stay_awake_while ./system/osx-settings
info "Success!"
echo
info "Next steps:"
echo "You must log out and back in for updated system settings to take effect."
echo
# vim: syntax=bash filetype=bash tw=0
{{ end -}}