osx

Updating Homebrew after OS upgrade

Unfortunatrly, Homebrew breaks after an upgrade to OS X Yosemite.

Unfortunatrly, Homebrew breaks after an upgrade to OS X Yosemite. brew update or any other brew request brings the following error:

/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory

/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0

Apple updated its default Ruby version to 2.0 and completely removed 1.8.

We found a couple of interesting ideas but here is what worked for us:

1) Trick Homebrew onto believing that Ruby 1.8 is still there

$ cd /System/Library/Frameworks/Ruby.framework/Versions
$ sudo ln -s Current 1.8

2) Remove Homebrew

$ cd \`brew --prefix

$ rm -rf Cellar
$ bin/brew prune
$ pbpaste | xargs -0 rm

$ rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions

$ rmdir -p bin Library share/man/man1 2> /dev/null

$ rm -rf .git

$ rm -rf ~/Library/Caches/Homebrew

$ rm -rf ~/Library/Logs/Homebrew

3) Install Homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

$ brew update

4) Cleanup

$ cd /System/Library/Frameworks/Ruby.framework/Versions

$ sudo rm 1.8

Subscribe to The infinite monkey theorem

Get the latest posts delivered right to your inbox