RVM:可以设置默认ruby版本但不能设置当前版本
RVM: Can set the default ruby version but cannot set the current version
问题:尽管默认 ruby 设置为 ruby 2.2.2。当我打开终端时 ruby 2.2.1 被加载。如何确保 ruby 2.2.2 在我打开新终端时加载。
问题表述不同:我无法将 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
为 ruby-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
设置为 ruby 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 <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [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/ruby-2.2.1@global/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/ruby-2.2.1@global"
MY_RUBY_HOME: "/home/rk/.rvm/rubies/ruby-2.2.1"
IRBRC: "/home/rk/.rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""
对我来说,按照命令完成工作
rvm --default use 2.2.2
您可能在登录 shell 时遇到问题,需要使用 /bin/bash --login
作为命令
我通过将 Rails 应用程序中的 .ruby-version 文件更新为您尝试使用的较新 ruby 版本(2.2.2 in你的情况)
问题:尽管默认 ruby 设置为 ruby 2.2.2。当我打开终端时 ruby 2.2.1 被加载。如何确保 ruby 2.2.2 在我打开新终端时加载。
问题表述不同:我无法将 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
为 ruby-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
设置为 ruby 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 <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [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/ruby-2.2.1@global/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/ruby-2.2.1@global"
MY_RUBY_HOME: "/home/rk/.rvm/rubies/ruby-2.2.1"
IRBRC: "/home/rk/.rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""
对我来说,按照命令完成工作
rvm --default use 2.2.2
您可能在登录 shell 时遇到问题,需要使用 /bin/bash --login
作为命令
我通过将 Rails 应用程序中的 .ruby-version 文件更新为您尝试使用的较新 ruby 版本(2.2.2 in你的情况)