在Mac OSX上安装1.9.3后显示Ruby 1.8.7

时间:2012-11-26 11:29:27

标签: ruby rvm

我以为我已经安装了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$ 

1 个答案:

答案 0 :(得分:4)

使用rvm install将下载并编译ruby版本,但您仍需要声明要使用的版本。

尝试:

$ rvm use 1.9.3-p327

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

$ rvm --default use 1.9.3-p327

rvm website有一些很棒的文档,包含更多信息。