Like an idiot, I managed to delete my system ruby install.
I've re-installed xcode, and also installed RVM
Doing this:
$ which ruby
returns this:
/Users/alex/.rvm/bin/ruby
However, Homebrew still seems to be broken:
$ brew
-bash: /usr/local/bin/brew: /usr/bin/ruby: bad interpreter: No such file or directory
The system ruby on OS X is symlinked to the Ruby.framework. Since you reinstalled Xcode, it should be installed, but you need to restore the symlinks.
First, check that this file exists and works.
$ /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
If that command works, you should be able to setup the sym links again
cd /usr/bin
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby /usr/bin/ruby
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/erb /usr/bin/erb
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/gem /usr/bin/gem
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/irb /usr/bin/irb
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/rake /usr/bin/rake
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/rdoc /usr/bin/rdoc
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ri /usr/bin/ri
sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/testrb /usr/bin/testrb
This should get you started, hopefully I haven't forgotten any of the binaries that need linked. There are other suggestions to reinstall ruby here: https://superuser.com/questions/171433/is-it-possible-to-reinstall-fix-mac-os-xs-system-ruby-without-doing-a-complete
Another method in a gist: https://gist.github.com/1418384
If you don't want to have to reinstall the system ruby, the following should do the trick.
IMPORTANT: replace MY_USER_NAME
with the name of your home folder, which is the "short name" of your user in OS X.
sudo ln -s /Users/MY_USER_NAME/.rvm/bin/ruby /usr/bin/ruby
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With