Homebrew Packages Not Found After Upgrading OS X

Today at work I ran into a really irritating issue. None of my installed homebrew packages were found and when I tried to install them again using brew install it told me they were already installed. My paths all checked out fine and I couldn’t figure out what the problem was.

Then I realized that this all happened after upgrading OS X.

#How to fix a broken homebrew install after upgrading OS X

The trick to fixing homebrew after upgrading OS X is a script I found in this stackexchange post:

#!/bin/bash
FORMULAS=(`brew list`);
for FORMULA in "${FORMULAS[@]}"
do 
    echo "brew unlink $FORMULA" && echo "brew link $FORMULA";
    OUTPUT=`brew unlink $FORMULA`;
    echo $OUTPUT;
    OUTPUT=`brew link $FORMULA`;
    echo $OUTPUT;
done

This solved the issue for me, and if that doesn’t work it was suggested to uninstall and reinstall all packages using the following:

brew list > brew-list.txt
brew uninstall < `cat brew-list.txt`
brew install < `cat brew-list.txt`

Which appears way more time consuming, so I would only use that as a last resort.

blog comments powered by Disqus