Skip to content

Instantly share code, notes, and snippets.

@ilg-ul
Last active November 5, 2016 10:11
Show Gist options
  • Save ilg-ul/fd1a5fb8ef45dedb35b9 to your computer and use it in GitHub Desktop.
Save ilg-ul/fd1a5fb8ef45dedb35b9 to your computer and use it in GitHub Desktop.
Install Homebrew in /opt/homebrew.
#!/usr/bin/env bash
if [[ ${DEBUG} != "" ]]; then
set -x
fi
set -o errexit
set -o pipefail
set -o nounset
IFS=$'\n\t'
# https://gist.github.com/ilg-ul/383869cbb01f61a51c4d
# ----------------------------------------------------------------------------
HB_PREFIX=${HB_PREFIX:-"/opt/homebrew"}
echo 'Enter sudo password'
sudo rm -rf "${HB_PREFIX}"
sudo mkdir -p "${HB_PREFIX}"
sudo chown -R $(whoami) "${HB_PREFIX}"
bash -c "(curl -L https://github.com/Homebrew/homebrew/tarball/master | tar -x -v --strip 1 -C "${HB_PREFIX}" -f -)"
brew --version
rm -rf "${HB_PREFIX}/share/doc/homebrew"
brew update
# To use Homebrew, add something like this to ~/.profile
echo alias hb=\'export PATH=${HB_PREFIX}/bin:\$PATH\'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment