如何将RVM中的gemset设置为默认值?

发布于 2025-01-05 07:03:20 字数 621 浏览 0 评论 0原文

每当我在 Mac OS X 中启动新终端时,我都会尝试将 gemset 设置为默认值:

rvm use [email protected] --create --default

这似乎有效,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

$

但是当我打开新终端时,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

$

我该怎么办?

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

rvm use [email protected] --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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

☆獨立☆ 2025-01-12 07:03:20

您是否尝试过在创建 gemset 后指定 rvm --default use 如此通过:

 rvm --default use [email protected]

然后看看是否仍然有效?同时使用 create 和 default 并不是我以前尝试过的,这是唯一让我觉得不合适的事情。

鉴于下面的讨论,我将提供此作为处理该问题的方法。 (就我个人而言,我可能会内爆rvm并重新开始。)但是 ,如果您想尝试通过此安装进行操作,那么我会查看您的 .rvm 文件夹,特别是在 .rvm/environments/default 中,它将包含导出的所有环境变量对于默认环境。在这里您会发现 rvm_gemset_name 这可能设置不正确,并且由于某种原因(权限?)而未更新,或者设置正确,在这种情况下是其他一些环境问题。如果不正确,您可以尝试在文件中手动设置它。

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

 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.

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.

我的黑色迷你裙 2025-01-12 07:03:20

您可以使用此命令。

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

rvm --default use @

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

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 
傲影 2025-01-12 07:03:20

使用以下命令将宝石集设置为默认值。

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

例如。

 rvm use 1.8.7-p370@mygemset --default

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
遮了一弯 2025-01-12 07:03:20

有趣的是没有人提到 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

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
若相惜即相离 2025-01-12 07:03:20

与 ruby​​racer 相关的问题也可能与 libv8 一起出现。
要解决这个问题:
步骤 1:运行以下命令卸载任何现有的 libv8 安装:

gem uninstall libv8

通过运行以下命令安装 ruby​​racer:

gem install therubyracer -v 0.12.2

通过运行以下命令安装 libv8:

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

立即尝试捆绑安装:

bundle install

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
如歌彻婉言 2025-01-12 07:03:20

您可以使用此命令

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

例如:
ruby version = ruby​​-2.1.2

gemset name = gem320

即使

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

您还打开其他选项卡,它也会保留设置。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文