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