{{ if and (not .unRootMode) (eq .chezmoi.os "darwin") -}}
#!/bin/sh

# Install Homebrew
command -v brew >/dev/null 2>&1 || \
  (echo '🍺  Installing Homebrew' && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")

brew bundle --file=/dev/stdin <<EOF
{{ range .packages.darwin.taps -}}
tap {{ . | quote }}
{{ end -}}
{{ range .packages.darwin.brews -}}
brew {{ . | quote }}
{{ end -}}
{{ range .packages.darwin.casks -}}
cask {{ . | quote }}
{{ end -}}
EOF
{{ end -}}
