Installing Homebrew on Yosemite

One of the downsides of playing with beta software is that your stuff breaks. For OS X 10.10 (Yosemite), Homebrew was one of those things.

Here’s how I fixed it:

  1. Nuke the previous one.

    rm -rf /usr/local/Cellar

  2. Install the new one.

    ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/
    homebrew/go/install)”

  3. Run Brew Doctor.

    brew doctor

  4. Clean up any issues.
  5. Install your software.

Now you’ll be running with Ruby 2.x (default in Yosemite) as well as the latest Homebrew.

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!

OSX 10.10下brew不能使用

似乎是10.10下默认Ruby版本已经2.0了,但是homebrew好像还在依赖1.8.7,所以目前brew属于瘫痪状态。

只要修改/usr/local/Library/brew.rb文件,第一行1.8改成2.0。

就可以正常运行了。