我是
Ruby的新手,默认情况下我的mac上有2.0.0版本的Ruby.我试图获得最新版本,并按照这个问题:
How to update Ruby to 1.9.x on Mac?,但即便如此,最新版本仍为2.0.0.我复制了一些我用过的终端命令:
Last login: Sun Oct 11 19:58:56 on console Manish-MBP:~ manishgiri$ruby -v ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15] Manish-MBP:~ manishgiri$\curl -L https://get.rvm.io | bash -s stable --ruby % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 184 100 184 0 0 102 0 0:00:01 0:00:01 --:--:-- 102 100 22721 100 22721 0 0 9052 0 0:00:02 0:00:02 --:--:-- 9052 Downloading https://github.com/rvm/rvm/archive/1.26.11.tar.gz Downloading https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc',but no GPG software exists to validate it,skipping. Installing RVM to /Users/manishgiri/.rvm/ Adding rvm PATH line to /Users/manishgiri/.profile /Users/manishgiri/.mkshrc /Users/manishgiri/.bashrc /Users/manishgiri/.zshrc. Adding rvm loading line to /Users/manishgiri/.profile /Users/manishgiri/.bash_profile /Users/manishgiri/.zlogin. Installation of RVM in /Users/manishgiri/.rvm/ is almost complete: * To start using RVM you need to run `source /Users/manishgiri/.rvm/scripts/rvm` in all your open shell windows,in rare cases you need to reopen all shell windows. # Manish-Giri,# # Thank you for using RVM! # We sincerely hope that RVM helps to make your life easier and more enjoyable!!! # # ~Wayne,Michal & team. In case of problems: http://rvm.io/help and https://twitter.com/rvm_io rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>,Michal Papis <mpapis@gmail.com> [https://rvm.io/] Searching for binary rubies,this might take some time. No binary rubies available for: osx/10.11/x86_64/ruby-2.2.1. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Installing requirements for osx. Updating system....... Error running 'requirements_osx_brew_update_system ruby-2.2.1',showing last 15 lines of /Users/manishgiri/.rvm/log/1444608144_ruby-2.2.1/update_system.log https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.' ++ /scripts/functions/logging : rvm_error() 115 > rvm_pretty_print stderr ++ /scripts/functions/logging : rvm_pretty_print() 73 > case "${rvm_pretty_print_flag:=auto}" in ++ /scripts/functions/logging : rvm_pretty_print() 78 > case "${TERM:-dumb}" in ++ /scripts/functions/logging : rvm_pretty_print() 81 > case "$1" in ++ /scripts/functions/logging : rvm_pretty_print() 83 > [[ -t 2 ]] ++ /scripts/functions/logging : rvm_pretty_print() 83 > return 1 ++ /scripts/functions/logging : rvm_error() 117 > 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. ++ /scripts/functions/requirements/osx_brew : requirements_osx_brew_update_system() 381 > return 1 Requirements installation Failed with status: 1. Manish-MBP:~ manishgiri$brew update Error: The /usr/local directory is not writable. Even if this directory was writable when you installed Homebrew,other software may change permissions on this directory. Some versions of the "InstantOn" component of Airfoil are kNown to do this. You should probably change the ownership and permissions of /usr/local back to your user account. sudo chown -R $(whoami):admin /usr/local Manish-MBP:~ manishgiri$sudo chown -R $(whoami):admin /usr/local Password: Manish-MBP:~ manishgiri$ruby -v ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15] Manish-MBP:~ manishgiri$
看起来自制软件有问题,所以我决定更新它.我做了更改所有权和权限部分,并按照此问题的说明 – How do I update Homebrew?并执行brew更新.我得到了一份最新的回复.
接下来,我尝试了第一个答案中已知的rvm list,只是为了验证最新版本,然后我执行了rvm install current&& rvm使用电流.我收到了这个回复:
Last login: Sun Oct 11 20:01:18 on ttys000 Manish-MBP:~ manishgiri$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 # for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.1 # JRuby jruby-1.6.8 jruby[-1.7.19] jruby-head jruby-9.0.0.0.pre1 # Rubinius rbx-1.4.3 rbx-2.4.1 rbx[-2.5.2] rbx-head # Opal opal # Minimalistic ruby implementation - ISO 30170:2012 mruby[-head] # Ruby Enterprise Edition ree-1.8.6 ree[-1.8.7][-2012.02] # GoRuby goruby # Topaz topaz # MagLev maglev[-head] maglev-1.0.0 # Mac OS X SNow Leopard Or Newer macruby-0.10 macruby-0.11 macruby[-0.12] macruby-nightly macruby-head # IronRuby ironruby[-1.1.3] ironruby-head Manish-MBP:~ manishgiri$rvm install current && rvm use current system Now using system ruby.
毕竟,我认为它会升级到2.2.3但是当我运行ruby -v时,我仍然得到:ruby 2.0.0p645(2015-04-13修订版50299)[universal.x86_64-darwin15].
为什么更新失败了?我在我的Windows PC上安装了RubyInstaller,它使用的是2.2.3.
解决方法
尝试更新Homebrew,退出终端,然后重新打开.然后rvm install ruby-1.9.3-p551< - 使用你的版本# 还要确保将其设置为默认值. rvm –default使用{version#},然后重新打开. 我偶然得到了它.其中一些来自YouTube视频:
Setting Up Ruby [ Ruby on Rails from the Ground Up – 2/5 ].剩下的就是用尖锐的棍子戳它.