問題:雖然默認的ruby設置爲ruby 2.2.2。當我打開一個終端紅寶石2.2.1被加載。當我打開一個新終端時,如何確保ruby 2.2.2加載。RVM:可以設置默認的ruby版本,但不能設置當前版本
問題措辭不同:我無法設置current && default
爲ruby 2.2.2,除非我卸載ruby 2.2.1。這是我所得到的,當我鍵入rvm list
~ $ rvm list
rvm rubies
ruby-1.8.7-head [ x86_64 ]
ruby-1.8.7-p374 [ x86_64 ]
ruby-1.9.3-p551 [ x86_64 ]
ruby-2.0.0-p353 [ x86_64 ]
ruby-2.2.0 [ x86_64 ]
=> ruby-2.2.1 [ x86_64 ]
* ruby-2.2.2 [ x86_64 ]
ruby-2.2.4 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我想current && default
是紅寶石2.2.2。如果我輸入rvm use default
,我會得到如下結果(這是我想要的)。
~ $ rvm list
rvm rubies
ruby-1.8.7-head [ x86_64 ]
ruby-1.8.7-p374 [ x86_64 ]
ruby-1.9.3-p551 [ x86_64 ]
ruby-2.0.0-p353 [ x86_64 ]
ruby-2.2.0 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.2 [ x86_64 ]
ruby-2.2.4 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我怎樣才能確保每當我打開環境current && default
設置如上圖所示,以紅寶石2.2.2終端? 觀察:如果我卸載ruby 2.2.1,它默認爲上述情況。我有一些項目需要ruby 2.2.1,我不能那樣做。
該怎麼辦?
順便說which ruby
給出了下面的輸出:
~ $ which ruby
/home/rk/.rvm/rubies/ruby-2.2.1/bin/ruby
這裏有一個類似的問題,其一直無人接聽: RVM default is 2.1.1 but 2.1.2 is loaded initially
這裏是出放rvm info
:
~ $ rvm info
ruby-2.2.1:
system:
uname: "Linux X200 4.4.0-36-generiC#55~14.04.1-Ubuntu SMP Fri Aug 12 11:49:30 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/14.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.26.11 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "1 year 3 months 21 days 22 hours 56 minutes 31 seconds ago"
path: "/home/rk/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.1p85"
date: "2015-02-26"
platform: "x86_64-linux"
patchlevel: "2015-02-26 revision 49769"
full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]"
homes:
gem: "/home/rk/.rvm/gems/ruby-2.2.1"
ruby: "/home/rk/.rvm/rubies/ruby-2.2.1"
binaries:
ruby: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/ruby"
irb: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/irb"
gem: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/gem"
rake: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/rake"
environment:
PATH: "/home/rk/.rvm/gems/ruby-2.2.1/bin:/home/rk/.rvm/gems/[email protected]/bin:/home/rk/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/rk/.rvm/bin:/home/rk/.rvm/bin:/usr/local/heroku/bin:/home/rk/android-studio/bin:/home/rk/.rvm/bin"
GEM_HOME: "/home/rk/.rvm/gems/ruby-2.2.1"
GEM_PATH: "/home/rk/.rvm/gems/ruby-2.2.1:/home/rk/.rvm/gems/[email protected]"
MY_RUBY_HOME: "/home/rk/.rvm/rubies/ruby-2.2.1"
IRBRC: "/home/rk/.rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""
http://imgur.com/a/K0LSe需要。很久以前,我通過首選項啓用了登錄shell。請看看它。 –
是的,看起來很完美。以上命令對我來說工作正常 –
@ravikanth,是的,這應該是完美的,請參閱 'https:// rvm.io/rubies/default' – Chirag