简体   繁体   中英

RVM: can't install ruby

I couldn't do something with Ruby, so I decided to remove everything about Ruby (even default osx ruby, which means ruby -v says ruby command not found) and start from scratch. Now I even can't install Ruby, and Google doesn't help me.

What I've got now: Installed RVM.

What I want: Install ruby with rvm install 2.1.1

Problem: rvm install 2.1.1 throw the next error

Error running 'requirements_osx_brew_update_system ruby-2.1.1',
showing last 15 lines of /Users/volodymyr/.rvm/log/1410282497_ruby-2.1.1/update_system.log
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.'
++ rvm_pretty_print stderr
++ case "${rvm_pretty_print_flag:=auto}" in
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'Failed to update Homebrew, follow instructions here:
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.\n'
Failed to update Homebrew, follow instructions here:
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.
++ return 1
Requirements installation failed with status: 1.

I think important: when I do sudo brew update I get

/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0

Don't Uninstall Your System Ruby

Never, ever, ever uninstall your system Ruby. That way lies madness. RVM, rbenv, and chruby all exist so that you can you choose your own Ruby regardless of what's on the system, but removing system packages just causes you pain...as you have found out.

If You've Already Done It Anyway

Since you've already uninstalled your system Ruby, you can't use a system like Homebrew to install Ruby or its dependencies since Homebrew requires Ruby in the first place. Instead, you'll either have to grab a binary from somewhere, or use a package manager that doesn't depend on Ruby. For example, I use (and recommend) MacPorts .

The latest system Ruby on OS X Mavericks is ruby 2.0.0p451 (2014-02-24 revision 45167) , so you can run sudo port install ruby20 once you have MacPorts installed, and you will then have access to Ruby 2.0.0-p481, which should be close enough for most purposes.

You might also want to check Ask Different to see how to reinstall the real system Ruby without doing a full reinstall if you continue to have problems, but MacPorts with Ruby 2.0.0 installed should at least allow you to run most things that don't check a hard-coded location for Ruby. Your mileage may vary.

You should really replace the system ruby installation since a lot of things depend on the installation being there. If you absolutely require a work around you can edit the brew.rb file located in /usr/local/Library/brew.rb and change the shebang line (#! line at the top) to point your custom ruby location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM