Fixing Homebrew for OS X 10.10 Yosemite

OS X 10.10 Yosemite

Update: Homebrew was fixed while Yosemite was in beta. If you are running into problems after upgrading to Yosemite you can easily fix Homebrew by doing a git pull from /usr/local or do a brew update before updating your system to Yosemite. In other words it is no longer needed to make changes to your Homebrew install manually. Some great work by the Homebrew team!

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!

  • SanderWind


    I found a typo in the ‘cd $(brew –repository) && git commit -a -m ‘new ruby version 2.0′’ line.
    $(brew -repository) should be $(brew –repository) (double dash).


    • Actually in the blogpost itself it is written like that, the formatting of the page only seems to mess things up. Thanks for pointing it out though!

    • gsimons

      Thanks, single dash was not working for me, this works though.

  • Lifesaver!

  • Sven

    As long as you do not need to compile anything that works great.

    Do you have any workarounds for that?

    • What do you mean? Just did a “brew update” followed by a “brew upgrade” on my machine, it updated four programs and everything worked fine…

      • I think Sven is referring to this error-

        `SCons Error: option –osx-version-min: invalid choice: ‘10.10’ (choose from ‘10.6’, ‘10.7’, ‘10.8’, ‘10.9’)

        Error: Homebrew doesn’t know what compiler versions ship with your version

        of Xcode (6.0).`

  • Hein Haraldson Berg

    Used your recipe successfully on my job MBPr. Now at home, on my private MBPr, it complains about this:

    Homebrew requires Leopard or higher. For Tiger support, see:

    • @Haraldsono:disqus this is a fix if you are Yosemite, not for Leopard or Maverick etc. What version of OSX are you running on your private Macbook?

      • Hein Haraldson Berg

        Yosemite on both. Otherwise I wouldn’t be here. 🙂

        • *lol* ok because of the error message I was just double checking 😉 not seen that error message myself though, what does “brew doctor” give you?

          • Hein Haraldson Berg

            Any ‘brew’ command yields that same error…

          • eustachio

            I have the same issue with my Yosemite install.

          • Hein Haraldson Berg

            This is now working for me using Yosemite Beta 1.

          • After fixing it like this I had no problems whatsoever anymore…running the beta4 at the moment.

          • eustachio

            I’m on the public beta, build: 14A299l, and have the issue where it thinks it’s running on Tiger.

          • Hein Haraldson Berg

            Change the if test as described above. Then you’ll have to resolve a merge conflict as Homebrew changes brew.rb, and commit it again – and then you’re finally able to run brew update/upgrade/doctor.

          • Hein Haraldson Berg

            I jumped the gun on this one. It’s not fixed after all on my private Mac. I guess the culprit is this line in brew.rb (which I guess is different in your brew.rb as you probably kept your Homebrew more up to date):

            if MACOS and MACOS_VERSION < 10.5

            Version 10.10, as a number, will then probably evaluate to 10.1 and indeed be smaller. I’m now attempting to temporarily change the if test to check if the Mac OS version is less than 10, I will get back here with the results.

          • Manda

            I think I have this same problem, with the same line of code in my brew.rb file.. But I’m confused… What did you end up changing it to? And did it work?

          • Hein Haraldson Berg

            I changed it to 10, if I remember correctly.

            It did indeed work after updating Homebrew, solving the merge conflict etc.

    • Have the same error. Started by simply ‘brew install mongodb’ and unfortunately changing the version only doesn’t fix the problem. Thanks

  • Michał Gołębiowski

    I don’t think it’s about the Ruby version. Mavericks uses Ruby 2.0.0 as well and Homebrew works fine with it.

    • The only problem I had on Yosemite with homebrew got fixed by changing the location of Ruby.. was Homebrew working for you out of the box on Yosemite than?

      • Michał Gołębiowski

        I don’t have access to Yosemite beta; all I know is that Mavericks uses Ruby 2.0.0p451 and Homebrew works on it without any hassle so the problem must rely on sth else than just Ruby being 2.0.x.

      • Michał Gołębiowski

        For the record, the first line of the file /usr/local/Library/brew.rb is as follows for me on Mavericks:

        #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0

        And `Current` is a symlink pointing to `2.0`.

        • I think they already changed it indeed in the latest update of homebrew, the article here is already almost two months old 😉

          • Michał Gołębiowski

            So would it work now without any special hacks like that? 🙂

    • The problem is not that Ruby 2.0.0 is new, but that Ruby 1.8 has been removed (the path to the Ruby interpreter was hardcoded to the 1.8 version).

      • Yups that’s what I was trying to say, thanks @Håvard 🙂

      • Michał Gołębiowski

        Ah, that explains everything. 🙂 I assumed Mavericks had Ruby 2.0 only.

  • Batmtech

    Thank you very very much ! Mine is Yosemite beta 4 : i have successfully followed SanderWind ‘s correction and Hans van Gent’s “brew update” step 🙂

  • Pascal Scheffers


  • Thibaut Rey


  • David Gillies

    Well that was simple. Thanks.

  • Dani P.

    Thanks, you saved me a Sunday headache!

  • YvesChan

    Why /usr/local is under Git version control?

  • Alrt Tan

    I do hope those app developers upgrade their softwares immediately, it’s really irritating, when you do an upgrade and realize it also means apps not working.

  • Or, maybe, you kids using ruby could grow up and use #/usr/bin/env ruby 🙂

    I also notice in passing that doing this, will cause brew update to fail because of the merge conflict… but anyway, this post pointed me in the right direction and I’m grateful for that (I continue to maintain my lofty disdain for Ruby 🙂 )

  • Pat Ferrel

    Hmm, –repository is not a brew command for me. Where should I run git commit from? I know, I’ve been bad and haven’t updated often enough 🙁

    BTW Discus doesn’t work with Chrome on the Mac, the sign on fails, had to go to Firefox

  • Pat Ferrel

    @Pat Ferrel run git commit from /usr/local

  • roodyruby

    Thanks, buddy. That saved my day!

  • GP

    When I run the commit I get the error below.

    MacBook-Pro:~ USER$ cd $(brew –repository) && git commit -a -m ‘new ruby version 2.0′

    Error: Unknown command: –repository

    fatal: Not a git repository (or any of the parent directories): .git

    • You don’t need to do the changes and the commit anymore, see the update at the beginning of the blogpost. 🙂

  • Pingback: Fixing Apache after upgrading to Yosemite | Lawrence Naman | Lawrence Naman()

  • Pingback: Back at the grind stone. | My Ponderings()

  • ThingsThatMakeYouGoHmmmm

    Thanks! you rock!