I'm stuck to reinstall brew, ruby on El Capitan.
Actually I didn't remember how exactly it occurs, but I lost my brew and I don't get reinstall it.
This is the message I receive when I try to reinstall it:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'
First, some information:
>which ruby
/usr/local/bin/ruby
>ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin12.6.0]
And, if I try to fix ruby:
>rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p643]
[ruby-]2.1.4
[ruby-]2.1[.5]
[ruby-]2.2[.1]
[ruby-]2.2-head
ruby-head
>rvm install 2.2
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.1.tar.bz2
Checking requirements for osx.
About to install Homebrew, press `Enter` for default installation in `/usr/local`,
type new path if you wish custom Homebrew installation (the path needs to be writable for user)
:
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'
Requirements installation failed with status: 1.
How to proceed now?
I found out the problem.
I ran type -a ruby
and saw I had installed two ruby: one on /usr/bin and another on /usr/local/bin
I just mv /usr/local/bin/ruby /usr/local/bin/rubybkp
and solve the problem
After this I ran ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
to reinstall brew.