I faced some issue with Homebrew. I upgraded to Yosemite. After the upgrade, homebrew seems to be broken.

I would run any brew command and get this 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 26: /usr/local/Library/brew.rb: Undefined error: 0

How to resolve it?

  • I just upgraded from Mac OS X 10.8 to 10.10 (Yosemite), and homebrew works fine after the upgrade. Either this problem was fixed, or there was something different about my OS upgrade compared to everyone else posting here. – Yitz Apr 8 '15 at 14:50
up vote 239 down vote accepted

I decided to look this up and found that there is an issue. The issue is closed but it is not possible to simply run brew update because you will still get the same error.

So here is what you need to do:

cd /usr/local/Library
git pull origin master

In case you have changes in the directory (/usr/local/Library), the git pull will throw an error. In that case, you'll have to fetch the master branch and set it forcibly as master:

git fetch --all
git reset --hard origin/master

This will upgrade your homebrew and you can use brew again.

If you installed Homebrew as a non-root user, you'll need to cd to /Users/yourusername/homebrew/Library instead of /usr/local/Library.

  • 20
    yet another reason I love having a package manager built on git :) – spinlock Nov 3 '14 at 17:48
  • 3
    Exactly. Love software that simply runs from source and upgradable through git pull – Ranjith Ramachandra Nov 4 '14 at 7:34
  • 7
    Weird, I'm getting this fatal: Not a git repository (or any of the parent directories): .git – Gabriel R. Nov 24 '14 at 10:48
  • 2
    I'm getting this error: error: cannot open .git/FETCH_HEAD: Permission denied – sixty4bit Nov 25 '14 at 3:40
  • 6
    Try sudo git pull origin master – Ranjith Ramachandra Nov 25 '14 at 4:10

I found this solution:

That link describes it well, but in case the link goes down, here is what you need to do: Type these commands into your Terminal:

cd /System/Library/Frameworks/Ruby.framework/Versions
sudo ln -s Current 1.8
brew update
sudo rm 1.8
  • 2
    Unlike the accepted answer this actually worked. – Paul Jan 8 '15 at 22:17
  • This solution makes perfect sense. Thanks! – digit plumber Jan 20 '15 at 3:17
  • 2
    Worked for me unlike accepted answer. Thanks! – Jared Eitnier Apr 7 '15 at 17:41
  • This is the only thing that worked for me on 10.10.3 – user Apr 23 '15 at 5:58
  • Also works for 10.10.4 – Ralfonso Apr 30 '15 at 1:21

The version and location of Ruby changed with the new Mac OS X version.

To fix this in a generic way, edit /usr/local/Library/brew.rb.

On the first line, replace 1.8 with Current, i.e. from:

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


#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
  • This breaks brew update because you now have an uncommitted change. – pricj004 Nov 28 '14 at 0:58
  • 1
    …but to do brew update one has to apply the fix I suggested.I never used brew update until now, so I didn't even have the repo initialized. Can't remember how I even installed it. – Gabriel R. Nov 28 '14 at 11:18

If you fix the ruby problem and then hit a problem where you are told that the system thinks you are running tiger or an older release, the fix for that is here

I first tried the highest rated answer an then hit another issue. After that I kind of gave up on fixing it since I had just a couple packages installed. Maybe others are in this boat as well.

While these are all excellent answers, for me it was simpler to just to re-install brew.

First, I ran the instructions on:


which directed me to first uninstall, and printed a command line. I ran that command line to uninstall, then re-installed, and everything was fine.

I don't want to print the specific commands, as they tend to change a bit as brew adjust how things are installed.

protected by Community Jun 4 '15 at 15:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.