6 function _install_brew() {
7 # Straight from https://brew.sh
8 #/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
10 if [[ -n "$(uname -a | grep -i darwin)" ]]; then
11 needs_xcode="$(/usr/bin/xcode-select -p > /dev/null 2> /dev/null || echo "true")"
12 if [[ -n ${needs_xcode} ]]; then
15 echo "ERROR: Run this command to install XCode Command Line Tools first:"
17 echo " xcode-select --install"
19 echo "After the install, close this terminal, open a new one, and try again."
23 if [ -z "$(command -v gcc)" ]; then
24 echo >&2 "Warning: to install 'gcc' et al on Linux use the built-in package manager."
25 echo >&2 " For example, try: sudo apt install -y build-essential"
27 if [ -z "$(command -v git)" ]; then
28 echo >&2 "Error: to install 'git' on Linux use the built-in package manager."
29 echo >&2 " For example, try: sudo apt install -y git"
34 # From Straight from https://brew.sh
35 if ! [ -d "$HOME/.local/opt/brew" ]; then
36 echo "Installing to '$HOME/.local/opt/brew'"
38 echo "If you prefer to have brew installed to '/usr/local' cancel now and do the following:"
39 echo " rm -rf '$HOME/.local/opt/brew'"
40 echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
43 git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.local/opt/brew"
46 webi_path_add "$HOME/.local/opt/brew/bin"
47 export PATH="$HOME/.local/opt/brew/bin:$PATH"
49 echo "Updating brew..."
52 webi_path_add "$HOME/.local/opt/brew/sbin"
53 export PATH="$HOME/.local/opt/brew/sbin:$PATH"
55 echo "Installed 'brew' to '$HOME/.local/opt/brew'"
57 echo "If you prefer to have brew installed to '/usr/local' do the following:"
58 echo " mv '$HOME/.local/opt/brew' '$HOME/.local/opt/brew.$(date '+%F_%H-%M-%S').bak'"
59 echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'