Last active
July 11, 2024 12:20
-
-
Save m1yag1/bb0ffef90bbc40f313844ec92427ac95 to your computer and use it in GitHub Desktop.
Bash script for installing homebrew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This is part of a larger script for setting a mac for python development. | |
set -e | |
# Shared functions | |
pretty_print() { | |
printf "\n%b\n" "$1" | |
} | |
# | |
pretty_print "Here we go..." | |
# So it begins | |
# Homebrew installation | |
if ! command -v brew &>/dev/null; then | |
pretty_print "Installing Homebrew, an OSX package manager, follow the instructions..." | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
if ! grep -qs "recommended by brew doctor" ~/.zshrc; then | |
pretty_print "Put Homebrew location earlier in PATH ..." | |
printf '\n# recommended by brew doctor\n' >> ~/.zshrc | |
printf 'export PATH="/usr/local/bin:$PATH"\n' >> ~/.zshrc | |
export PATH="/usr/local/bin:$PATH" | |
fi | |
else | |
pretty_print "You already have Homebrew installed...good job!" | |
fi | |
# Homebrew OSX libraries | |
pretty_print "Updating brew formulas" | |
brew update | |
pretty_print "Installing GNU core utilities..." | |
brew install coreutils | |
pretty_print "Installing GNU find, locate, updatedb and xargs..." | |
brew install findutils | |
pretty_print "Installing the most recent verions of some OSX tools" | |
brew tap homebrew/dupes | |
brew install homebrew/dupes/grep | |
printf 'export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"' >> ~/.zshrc | |
export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment