-
Notifications
You must be signed in to change notification settings - Fork 0
/
brew.sh
executable file
·58 lines (50 loc) · 1.95 KB
/
brew.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
#!/usr/bin/env bash
set -eu
# Install homebrew if necessary
if ! command -v brew &> /dev/null; then
read -p 'Homebrew not found. Install it? (y/N) ' -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo 'Installing Homebrew...'
# See https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo 'You can install it manually from https://brew.sh/. Exiting.'
exit 1
fi
fi
# Install command-line tools using Homebrew. This script uses the brew bundle
# functionality. See https://github.com/Homebrew/homebrew-bundle.
# To add new things, brew bundle dump --describe --force
# Install or upgrade everything in the Brewfile
brew bundle install
# Switch to using brew-installed zsh as default shell
if ! grep -q '/usr/local/bin/zsh' /etc/shells; then
echo '/usr/local/bin/zsh' | sudo tee -a /etc/shells
chsh -s /usr/local/bin/zsh
fi;
# Enable fzf autocomplete and fuzzy-finding in bash
# See brew info fzf
$(brew --prefix)/opt/fzf/install \
--key-bindings \
--completion \
--no-update-rc \
--no-bash \
--no-fish
# git send-email uses perl, but requires additional perl modules. Further, git
# doesn't require the perl brew formula, and won't use the brewed perl unless
# you pass --with-perl. Thus:
# 1. Install brew's perl
# 2. Use brewed perl's cpan to install the three required modules for
# send-email.
# 3. Install git and use --with-perl to point it at the brewed perl.
# See https://github.com/Homebrew/homebrew-core/issues/12870 for further
# information.
# aaand the interactive.singleKey config requires Term::ReadKey, which
# apparently doesn't come standard with the brew perl. Maybe this isn't worth it
# just to get send-email working.
# -T: don't run tests
# cpan -T Net::SMTP::SSL MIME::Base64 Authen::SASL Term::ReadKey 2>/dev/null
# Remove outdated versions from the cellar.
brew cleanup
brew cask cleanup --outdated