1

我以为我已经安装了 ruby​​ 1.9.3-p327。但是当我执行 ruby​​ -v 时,它仍然输出 1.8.7,如下所示。

怎么了?

我使用 OSX 10.7.5 并安装了 osx-gcc-installer 和 Xcode 4.5.2。

更新:我检查了 /User/teacher/.rvm/bin/folder ,发现有 ruby​​-1.9.3 文件。

Last login: Mon Nov 26 19:50:24 on ttys000
sokada-macbook:~ teacher$ sudo rvm install 1.9.3
Password:
No binary rubies available for: downloads/ruby-1.9.3-p327.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /Users/teacher/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  460k  100  460k    0     0   184k      0  0:00:02  0:00:02 --:--:--  196k
Extracting yaml to /Users/teacher/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/teacher/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/teacher/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/teacher/.rvm/usr
Installing Ruby from source to: /Users/teacher/.rvm/rubies/ruby-1.9.3-p327, this may take a while depending on your cpu(s)...
ruby-1.9.3-p327 - #downloading ruby-1.9.3-p327, this may take a while depending on your connection...
ruby-1.9.3-p327 - #extracting ruby-1.9.3-p327 to /Users/teacher/.rvm/src/ruby-1.9.3-p327
ruby-1.9.3-p327 - #extracted to /Users/teacher/.rvm/src/ruby-1.9.3-p327
ruby-1.9.3-p327 - #configuring
ruby-1.9.3-p327 - #compiling
ruby-1.9.3-p327 - #installing 
Retrieving rubygems-1.8.24
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  371k  100  371k    0     0   819k      0 --:--:-- --:--:-- --:--:-- 1819k
Extracting rubygems-1.8.24 ...
Removing old Rubygems files...
Installing rubygems-1.8.24 for ruby-1.9.3-p327 ...
Installation of rubygems completed successfully.
Saving wrappers to '/Users/teacher/.rvm/bin'.
ruby-1.9.3-p327 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p327 - #importing default gemsets (/Users/teacher/.rvm/gemsets/), this may take time ...
Install of ruby-1.9.3-p327 - #complete 
'rvm_codesign_identity' is not set, please set it in ~/.rvmrc
sokada-macbook:~ teacher$ rvm -v

rvm 1.16.20 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

sokada-macbook:~ teacher$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
sokada-macbook:~ teacher$ chmod -x $rvm_path/hooks/after_install_codesign
sokada-macbook:~ teacher$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
sokada-macbook:~ teacher$ 
4

1 回答 1

3

Usingrvm install将下载并编译一个 ruby​​ 版本,但您仍然需要声明要使用哪个版本。

尝试:

$ rvm use 1.9.3-p327

切换到新安装的 ruby​​ 版本。要切换版本并设置为默认值:

$ rvm --default use 1.9.3-p327

rvm网站有一些很棒的文档,其中包含更多信息。

于 2012-11-26T11:47:12.343 回答