-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrew.zsh
71 lines (59 loc) · 2.2 KB
/
brew.zsh
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
#!/usr/bin/env zsh
source ./util.zsh
# Install command-line tools using Homebrew.
function brew_install_if_missing() {
if [[ -z "$1" ]]; then
echo "Usage: brew_install_if_missing <package_name>"
return 1
fi
local package=$1
if brew list --formula | grep -q "^$package\$"; then
print_skip_msg "$package"
else
print_install_msg "$package"
brew install "$package"
if [[ $? -eq 0 ]]; then
print_success_msg "$package has been successfully installed."
else
print_failed_msg "Failed to install $package"
fi
fi
}
# Make sure we’re using the latest Homebrew.
brew update
# Upgrade any already-installed formulae.
brew upgrade
# GNU softwares
brew_install_if_missing gnupg
brew_install_if_missing grep
brew_install_if_missing gnu-tar
# Alternatives made with Rust
brew_install_if_missing bat # cat alternative
brew_install_if_missing fd # find alternative. Used by telescope.nvim
brew_install_if_missing eza # ls alternative
brew_install_if_missing sd # sed alternative
brew_install_if_missing gitui # lazygit alternative. Git TUI
brew_install_if_missing starship # spaceship alternative. Prompt
brew_install_if_missing font-hack-nerd-font
brew_install_if_missing fzf # Fuzzy find history and neovim
brew_install_if_missing gh
brew_install_if_missing git # Use the latest version
brew_install_if_missing lazygit # Git TUI. Will be deleted if gitui supports ssh-agent https://github.com/extrawurst/gitui/issues/2378
brew_install_if_missing mas # CLI for Mac App Store
brew_install_if_missing neovim
brew_install_if_missing ripgrep # Required by telescope.nvim
brew_install_if_missing sheldon # Zsh Plugin Manager
brew_install_if_missing sqlite # Use the latest version, required by telescope-all-recent
brew_install_if_missing tree
brew_install_if_missing tmux
brew_install_if_missing vim # Use the latest version
brew_install_if_missing wget
brew_install_if_missing zsh # Use the latest version
# Switch to using brew-installed zsh as default shell
BREW_PREFIX=$(brew --prefix)
if ! grep -Fq "${BREW_PREFIX}/bin/zsh" /etc/shells; then
echo "${BREW_PREFIX}/bin/zsh" | sudo tee -a /etc/shells;
chsh -s "${BREW_PREFIX}/bin/zsh";
fi;
# Remove outdated versions from the cellar.
brew cleanup