Search code examples
rubyrubygemshomebrewosx-yosemite

Homebrew error in OS X. Bad interpreter: Too Many levels of symbolic links. Undefined error: 0


I've been searching for an answer to this problem for a few weeks now, and while I've seen similar problems, none that I have found have been exactly like the error I'm experiencing. I've tried uninstalling and reinstalling Homebrew to no avail. I'm not the most experienced user in the world of bash scripting and the command line in general, so be gentle with me.

I'm running Mac OS X 10.10.1 Yosemite.

Anyway, whenever I try to run a brew command, I get the following error-

PJs-iMac:~ peterjohnjoseph$ brew doctor
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: bad interpreter: Too many levels of symbolic links
/usr/local/bin/brew: line 28: /usr/local/Library/brew.rb: Undefined error: 0

I opened the usr/local/bin/brew file and it looks just like a copy of the error I'm seeing -

Last login: Fri Jan  9 10:39:41 on ttys001
PJs-iMac:~ peterjohnjoseph$ /usr/local/bin/brew ; exit;
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: bad interpreter: Too many levels of symbolic links
/usr/local/bin/brew: line 28: /usr/local/Library/brew.rb: Undefined error: 0
logout

[Process completed]

The other thing is, I'm finding something that doesn't seem right to me (but I could be wrong) in the /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby folders.

First off, when clicking on ruby.framework/Versions the contents are an alias for 1.8 (is this supposed to be there if 2.0 is the default installed with os x 10.10? The alias also says it can't find the original item), a 2.0 folder, and a "Current' alias that when clicked on says the original item can not be found also. Inside the 2.0 folder, the "Current" alias there also can't find the original item.

Is any of this off, and could it have anything to do with why I'm getting the Homebrew error? This could be extremely simple and I just have to delete a line from a file, or it could be larger and involve the potential problems I found above. Any help would be greatly appreciated. I have some things I need to install this week, so I'm trying everything I can to figure and solve this. I'll give you any information you need in order to assist you in helping me.

Thanks, P.J.


Solution

  • $cd /System/Library/Frameworks/Ruby.framework/Versions/
    $sudo rm Current
    $sudo ln -s 2.0 Current
    
    (If you have ruby v 1.8 
    $sudo ln -s 1.8 Current)
    
    $sudo brew update