Skip to content

Instantly share code, notes, and snippets.

@dannysmith
Created July 9, 2016 20:10
Show Gist options
  • Select an option

  • Save dannysmith/73deb871d83bdfd1ff1b0ee615204af9 to your computer and use it in GitHub Desktop.

Select an option

Save dannysmith/73deb871d83bdfd1ff1b0ee615204af9 to your computer and use it in GitHub Desktop.
# Install Homebrew
fancy_echo "Creating ~/.bin folder..."
if [ ! -d "$HOME/.bin/" ]; then
mkdir "$HOME/.bin"
fi
HOMEBREW_PREFIX="/usr/local"
if [ -d "$HOMEBREW_PREFIX" ]; then
if ! [ -r "$HOMEBREW_PREFIX" ]; then
echo $passwd | sudo -S -k chown -R "$LOGNAME:admin" /usr/local
fi
else
echo $passwd | sudo -S -k mkdir "$HOMEBREW_PREFIX"
echo $passwd | sudo -S -k chflags norestricted "$HOMEBREW_PREFIX"
echo $passwd | sudo -S -k chown -R "$LOGNAME:admin" "$HOMEBREW_PREFIX"
fi
gem_install_or_update() {
if gem list "$1" --installed > /dev/null; then
gem update "$@"
else
gem install "$@"
rbenv rehash
fi
}
if ! command -v brew >/dev/null; then
fancy_echo "Installing Homebrew ..."
curl -fsS \
'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby
export PATH="/usr/local/bin:$PATH"
fi
if brew list | grep -Fq brew-cask; then
fancy_echo "Uninstalling old Homebrew-Cask..."
brew uninstall --force brew-cask
fi
fancy_echo "Updating Homebrew formulae..."
brew update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment