Skip to content

Instantly share code, notes, and snippets.

@canering
Forked from lojikil/brewinst.sh
Created October 4, 2016 05:24
Show Gist options
  • Save canering/e57a877ee0271f19d67d34b89c4eb524 to your computer and use it in GitHub Desktop.
Save canering/e57a877ee0271f19d67d34b89c4eb524 to your computer and use it in GitHub Desktop.
backup copy of a single-user `brew` installation
# change to whatever location to where homebrew is installed
if [ -z "$HOMEBREW_HOME" ]; then
export HOMEBREW_HOME=$HOME/homebrew
echo "HOMEBREW_HOME=$HOME/homebrew" >> ~/.profile
fi
# install homebrew for single user
if [ ! -d "$HOMEBREW_HOME" ]; then
mkdir -p $HOMEBREW_HOME && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C $HOMEBREW_HOME
fi
# add the new homebrew bin directory to the path
if [ -z `echo $PATH | grep "$HOMEBREW_HOME"` ]; then
echo "PATH=$HOMEBREW_HOME/bin:$PATH" >> ~/.profile
export PATH=$HOMEBREW_HOME/bin:$PATH
fi
# configure the local homebrew cache directory
if [ -z "$HOMEBREW_CACHE" ]; then
echo "HOMEBREW_CACHE=$HOME/Library/Caches/Homebrew" >> ~/.profile
export HOMEBREW_CACHE=$HOME/Library/Caches/Homebrew
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment