After installing Yosemite, I was unable to run brew or ruby.
I was getting this error on brew update:
/usr/local/bin/brew: /usr/local/Library/brew.r
brew update error can be fixed with this:
sudo chown -R $USER:admin /usr/local cd /usr/local git reset --hard origin/master brew update
https://github.com/Homebrew/homebrew/issues/19140