After updating to OS X Yosemite, brew breaks. When I run brew, it shows 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 21: /usr/local/Library/brew.rb: Undefined error: 0
OS X Yosemite comes with ruby 2.0 bundled but Homebrew is designed to work with ruby 1.8.x. So this error can be fixed in the following steps:
1) Open terminal
2) nano /usr/local/Library/brew.rb
3) In the first line change “1.8″ to “current”, so it should look like this:
Note: Although above steps get Homebrew works again on Yosemite, Homebrew can not be updated. When running "brew update" command, it complains that
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.
A more simple way to get Homebrew work on Yosemite is to create a symbolic link
"/System/Library/Frameworks/Ruby.framework/Versions/1.8" linked to
by using command
sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0
At this time, you should be able to update brew, and then delete the symbolic link.