Skip to content

Instantly share code, notes, and snippets.

@chriswgerber
Created September 6, 2017 15:12
Show Gist options
  • Save chriswgerber/c3e237840a3789b2db2057fdf799185e to your computer and use it in GitHub Desktop.
Save chriswgerber/c3e237840a3789b2db2057fdf799185e to your computer and use it in GitHub Desktop.
Single-User Homebrew Install
export HOMEBREW_INSTALL_BADGE="🦍"
export HOMEBREW_PREFIX="$HOME"
export HOMEBREW_REPOSITORY="$HOME/Library/Homebrew"
test -d $HOMEBREW_REPOSITORY || git clone git@github.com:Homebrew/brew.git $HOMEBREW_REPOSITORY
# install homebrew for single user
# add the new homebrew bin directory to the path
if [ -z `echo $PATH | grep "$HOMEBREW_REPOSITORY"` ]; then
if [[ "$SHELL" == *"bash"* ]]; then
echo "PATH=$HOMEBREW_REPOSITORY/bin:$PATH" >> ~/.zshrc
else
echo "PATH=$HOMEBREW_REPOSITORY/bin:$PATH" >> ~/.profile
fi
export PATH=$HOMEBREW_HOME/bin:$PATH
fi
# configure the local homebrew cache directory
if [ -z "$HOMEBREW_CACHE" ]; then
if [[ "$SHELL" == *"bash"* ]]; then
echo "HOMEBREW_CACHE=$HOME/Library/Caches/Homebrew" >> ~/.zshrc
else
echo "HOMEBREW_CACHE=$HOME/Library/Caches/Homebrew" >> ~/.profile
fi
fi
export HOMEBREW_CACHE=$HOME/Library/Caches/Homebrew
# Cask
export HOMEBREW_CASK_OPTS="--appdir=${HOME}/Applications"
# Completions
fpath=($HOMEBREW_REPOSITORY/share/zsh/site-functions $fpath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment