Last active
December 18, 2015 21:59
-
-
Save zackintosh/5851654 to your computer and use it in GitHub Desktop.
Fixes homebrew's taps when they are reported as broken when running "brew doctor" (eg. "Error: Failed to import: bonjour-browser"). This seems to happen often when the cask (https://github.com/phinze/homebrew-cask) tap has been tapped.
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
#/usr/bin/env bash | |
# Fix homebrew taps and simlinks | |
brewDir=$(brew --prefix) | |
taps=($(brew tap)) #Save off the current taps into an array | |
# Untap everything | |
for i in "${taps[@]}" | |
do | |
printf "Untapping: $i\n" | |
brew untap $i 2>&1 | sed "s/^/ /" | |
printf "\n" | |
done | |
printf "Removing all tap formula directories and deleting all symlinks..." | |
rm -rf $brewDir/Library/Taps/* | |
find $brewDir/Library/Formula -type l -delete | |
printf "\n Done.\n\n" | |
for i in "${taps[@]}" | |
do | |
printf "Restoring tap: $i\n" | |
brew tap $i 2>&1 | sed "s/^/ /" | |
printf "\n" | |
done | |
printf "Checking for updates...\n" | |
brew update 2>&1 | sed "s/^/ /" | |
printf "\nChecking with the brew doctor...\n" | |
brew doctor 2>&1 | sed "s/^/ /" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment