Fixing Homebrew for OS X 10.10 Yosemite

Now that Apple opened up the beta program of their Desktop OS to everyone (not requiring a developer license anymore) a lot of people will be upgrading to OS X 10.10 already before the official release later on this year. I did it as well earlier this week, however I found out that one of my all time favourite “programs” was not working anymore on OS X 10.10. Homebrew, for those who don’t know it is “the missing package manager for OS X” and really saves a lot of time and trouble trying to install software on your mac system. It is like the ports collection from *BSD only for your Mac.

So are you like me, did the update to Yosemite and are now stuck with a non-working Homebrew? The fix is fairly simple. OSX 10.10 Yosemite comes with ruby 2.0 bundled and Homebrew is designed to work with ruby 1.8.x. So the only thing you have to do is:

  1. Open the file brew.rb using the following command: vi /usr/local/Library/brew.rb
  2. Change the first line from: #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0 to #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
  3. Save and exit brew.rb

Before you can do a “brew update” though you first have to commit your changes otherwise brew still does not work. Simply type in the following: cd $(brew –repository) && git commit -a -m ‘new ruby version 2.0′ and you are done. Happy updating your brew installation and continuing to work like you did before!