Skip to content

Commit 687ca94

Browse files
committed
Update brew formulaes provisioning script (#7)
This commit improves the brew formulaes provisioning script by checking existence of `brew` command before execution and also by adding informational messages after installing GNU utilities. The messages follow the content found in the following Pull Request on GitHub: mathiasbynens/dotfiles#871
1 parent 40483fa commit 687ca94

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

brew.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/env bash
2-
# Install CLI tools using Homebrew
2+
# Provisions libraries and software packages using Homebrew.
33
# Inspired by: https://github.com/mathiasbynens/dotfiles/blob/master/brew.sh
44

5-
# Make sure we are using the latest Homebrew
6-
brew update
5+
if ! [ -x "$(command -v brew)" ]; then
6+
echo 'Error: `brew` is not installed.' >&2;
7+
exit 1;
8+
fi
79

810
# Upgrade any already-installed packages
911
brew upgrade
@@ -12,17 +14,20 @@ brew upgrade
1214
BREW_PREFIX=$(brew --prefix)
1315

1416
# Install GNU core utilities (those that come with macOS are outdated)
17+
echo 'Be sure to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.'
1518
brew install coreutils
1619
ln -s "${BREW_PREFIX}/bin/gsha256sum" "${BREW_PREFIX}/bin/sha256sum"
1720

1821
# Install some other useful utilities like `sponge`
1922
brew install moreutils
2023
brew install findutils
24+
echo 'Add `$(brew --prefix findutils)/libexec/gnubin` to `$PATH` if you would prefer these be the defaults'
2125

2226
# Install GNU `sed`, overwriting the built-in `sed`
2327
brew install gnu-sed
28+
echo 'Be sure to add `$(brew --prefix gnu-sed)/libexec/gnubin` to `$PATH`.'
2429

25-
# Install Bash 4
30+
# Install Bash 5
2631
brew install bash
2732
brew install bash-completion2
2833

@@ -32,6 +37,9 @@ if ! fgrep -q "${BREW_PREFIX}/bin/bash" /etc/shells; then
3237
chsh -s "${BREW_PREFIX}/bin/bash";
3338
fi;
3439

40+
# Install wget
41+
brew install wget
42+
3543
# Install GnuPG to enable PGP-signing commits
3644
brew install gnupg
3745

0 commit comments

Comments
 (0)