Last active
December 23, 2023 11:37
-
-
Save Anarbb/c451db4d2b96b3755d34af248200e653 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#########. | |
########",#: | |
#########',##". | |
##'##'## .##',##. | |
## ## ## # ##",#. | |
## ## ## ## ##' | |
## ## ## :## | |
## ## ##." | |
goin=$1 | |
if [[ -z $goin ]] | |
then | |
goin="/Users/$USER/goinfre" | |
fi | |
goin="$goin/.brew" | |
echo Are you sure about that? install | |
# Delete and reinstall Homebrew from Github repo | |
rm -rf $goin | |
git clone --depth=1 https://github.com/Homebrew/brew $goin | |
# Create .brewconfig script in home directory | |
cat > $HOME/.brewconfig.zsh <<EOL | |
# HOMEBREW CONFIG | |
# Add brew to path | |
export PATH=$goin/bin:\$PATH | |
# Set Homebrew temporary folders | |
export HOMEBREW_CACHE=/tmp/\$USER/Homebrew/Caches | |
export HOMEBREW_TEMP=/tmp/\$USER/Homebrew/Temp | |
mkdir -p \$HOMEBREW_CACHE | |
mkdir -p \$HOMEBREW_TEMP | |
# If NFS session | |
# Symlink Locks folder in /tmp | |
if df -T autofs,nfs \$HOME 1>/dev/null | |
then | |
HOMEBREW_LOCKS_TARGET=/tmp/\$USER/Homebrew/Locks | |
HOMEBREW_LOCKS_FOLDER=\$goin/var/homebrew | |
mkdir -p \$HOMEBREW_LOCKS_TARGET | |
mkdir -p \$HOMEBREW_LOCKS_FOLDER | |
# Symlink to Locks target folders | |
# If not already a symlink | |
if ! [[ -L \$HOMEBREW_LOCKS_FOLDER && -d \$HOMEBREW_LOCKS_FOLDER ]] | |
then | |
echo "Creating symlink for Locks folder" | |
rm -rf \$HOMEBREW_LOCKS_FOLDER | |
ln -s \$HOMEBREW_LOCKS_TARGET \$HOMEBREW_LOCKS_FOLDER | |
fi | |
fi | |
EOL | |
# Add .brewconfig sourcing in your .zshrc if not already present | |
if ! grep -q "# Load Homebrew config script" $HOME/.zshrc | |
then | |
cat >> $HOME/.zshrc <<EOL | |
# Load Homebrew config script | |
source \$HOME/.brewconfig.zsh | |
EOL | |
fi | |
source $HOME/.brewconfig.zsh | |
brew update | |
echo "\nPlease open a new shell to finish installation" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment