macos 如何将 RVM 中的 gemset 设为默认值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9282326/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to make a gemset in RVM the default?
提问by at.
I'm trying to make a gemset the default whenever I start a new terminal in Mac OS X:
每当我在 Mac OS X 中启动新终端时,我都会尝试将 gemset 设为默认值:
rvm use [email protected] --create --default
That seems to work, the rails3.2 gemset becomes the current gemset:
这似乎有效,rails3.2 gemset 成为当前 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:
但是当我打开一个新终端时,rails3.2 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
$
What do I do?
我该怎么办?
回答by Mike K.
Have you tried specifying rvm --default use
after the gemset is created so passing:
您是否尝试rvm --default use
在创建 gemset 后指定,以便通过:
rvm --default use [email protected]
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.
然后看看是否坚持?同时使用 create 和 default 并不是我以前尝试过的,这是唯一让我觉得不合适的事情。
Given the discussion below I'd offer this as a means for dealing with the problem. (Personally, I'd probably implode rvmand 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.
鉴于下面的讨论,我将提供此作为处理问题的一种手段。(就我个人而言,我可能会内爆 rvm并重新开始。) 但是,如果您想尝试使用此安装来完成它,那么我会查看您的.rvm
文件夹,特别是.rvm/environments/default
其中将包含导出的所有环境变量默认环境。在这里,您会发现rvm_gemset_name
这可能设置不正确,并且由于某种原因(权限?)没有更新,或者设置正确,在这种情况下是其他一些环境问题。如果不正确,您可以尝试在文件中手动设置它。
回答by Amrit Dhungana
You can use this command.
您可以使用此命令。
rvm use --default <ruby version>@<gemset name>
or
或者
rvm --default use <ruby version>@<gemset name>
or
rvm --default use <ruby version>@<gemset name>
或者
rvm use <ruby version>@<gemset name> --default
回答by Ramiz Raja
Use following command to make a gemset as default.
使用以下命令将 gemset 设为默认值。
rvm use <ruby version>@<gemset name> --default
eg.
例如。
rvm use 1.8.7-p370@mygemset --default
回答by rubyemerite
You can use this command
你可以使用这个命令
$ rvm use rubyversion@gemsetname --create --ruby-version
For example : ruby version = ruby-2.1.2
例如:ruby 版本 = ruby-2.1.2
gemset name = gem320
宝石名称 = 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.
即使您也打开其他选项卡,它也会保留设置。
回答by rubyemerite
Interesting that nobody has mentioned rvm alias. Try your version-specific variation of this, works for me:
有趣的是没有人提到 rvm 别名。试试你的这个版本特定的变体,对我有用:
$ 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
回答by Sk. Irfan
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:
rubyracer
相关问题也可能与 libv8 一起出现。要解决此问题: 步骤 1:运行以下命令卸载任何现有的 libv8 安装:
gem uninstall libv8
Install rubyracer by running the following command:
通过运行以下命令安装 rubyracer:
gem install therubyracer -v 0.12.2
Install libv8 by running the following command:
通过运行以下命令安装 libv8:
gem install libv8 -v 3.16.14.15 -- --with-system-v8
Try bundle install now:
立即尝试捆绑安装:
bundle install