how to make a gemset in RVM the default?

别说谁变了你拦得住时间么 提交于 2019-11-29 01:39:11

问题


I'm trying to make a gemset the default whenever I start a new terminal in Mac OS X:

rvm use 1.9.3@rails3.2 --create --default

That seems to work, the rails3.2 gemset becomes the current gemset:

$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/me/.rvm/gems/ruby-1.9.3-p0)
   global
=> rails3.2

$

But when I open up a new terminal, the rails3.2 gemset is no longer the current:

$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/me/.rvm/gems/ruby-1.9.3-p0)
   global
   rails3.2

$

What do I do?


回答1:


Have you tried specifying rvm --default use after the gemset is created so passing:

 rvm --default use ruby-1.9.3-p0@rails3.2

and then seeing if that sticks? Using create and default at the same time isn't something I've tried before, it's the only thing that strikes me as out of place.

Given the discussion below I'd offer this as a means for dealing with the problem. (Personally, I'd probably implode rvm and start over.) But, if you wanted to try to make a go of it with this install then I'd look at your .rvm folder, specifically in .rvm/environments/default which will contain all the environment variables exported for the default environment. Here you'll find rvm_gemset_name this may be set incorrectly and isn't updated for some reason (permissions?) or is set correctly in which case its some other environment issue. You could try manually setting it here in the file if its not correct.




回答2:


Use following command to make a gemset as default.

rvm use <ruby version>@<gemset name> --default

eg.

 rvm use 1.8.7-p370@mygemset --default



回答3:


You can use this command.

rvm use --default <ruby version>@<gemset name>

or

rvm --default use <ruby version>@<gemset name> or

rvm use <ruby version>@<gemset name> --default 



回答4:


Interesting that nobody has mentioned rvm alias. Try your version-specific variation of this, works for me:

$ rvm alias create default ruby-2.3.0@rails_4_2_6
# me logs out, fetches another coffee
# me logs in
$ rvm list

rvm rubies

   ruby-2.2.4 [ x86_64 ]
=* ruby-2.3.0 [ x86_64 ]

$ rvm gemset list

gemsets for ruby-2.3.0 (found in /home/aclarke/.rvm/gems/ruby-2.3.0)
   (default)
   global
=> rails_4_2_6



回答5:


rubyracer related issue might as well come with libv8. To get around this issue: Step 1: Run the following command to uninstall any existing installation of libv8:

gem uninstall libv8

Install rubyracer by running the following command:

gem install therubyracer -v 0.12.2

Install libv8 by running the following command:

gem install libv8 -v 3.16.14.15 -- --with-system-v8

Try bundle install now:

bundle install



回答6:


You can use this command

$ rvm use rubyversion@gemsetname --create --ruby-version

For example : ruby version = ruby-2.1.2

gemset name = gem320

It would be

$ rvm use ruby-2.1.2@gem320 --create --ruby-version.

Even if you open other tab also, it will preserve the settings.



来源:https://stackoverflow.com/questions/9282326/how-to-make-a-gemset-in-rvm-the-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!