RVM 无法将 ruby​​ 设置为默认值 [英] RVM can't set ruby as default

查看:36
本文介绍了RVM 无法将 ruby​​ 设置为默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么,但 RVM 似乎无法更改默认的 Ruby.我正在使用 Oh My Zsh 并尝试了所有我发现的,但似乎没有任何效果.

I have no idea why but RVM can't seem to change the default Ruby. I'm using Oh My Zsh and tried everything I've found but nothing seems to work.

➜  Sites  rvm use 2.0.0 --default
Using /Users/anahkiasen/.rvm/gems/ruby-2.0.0-p247
➜  Sites  rvm list
rvm rubies

=* ruby-2.0.0-p247 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

➜  Sites  rvm reload && rvm list
RVM reloaded!

rvm rubies

 * ruby-2.0.0-p247 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

现在 Ruby 被设置为默认值,但 RVM 不会将其加载为当前",这意味着它不会加载附属于它的 gemset.

Now the Ruby is set as default but RVM doesn't load it as "current", which means it does not load the gemsets that are affiliated to it.

➜  Sites  rvm use 2.0.0
Using /Users/anahkiasen/.rvm/gems/ruby-2.0.0-p247
➜  Sites  gem list

*** LOCAL GEMS ***

backports (3.3.3)
bson (1.9.1)
bson_ext (1.9.1)
bundler (1.3.5)
bundler-unload (1.0.1)
eventmachine (1.0.3)
genghisapp (2.3.7)
json (1.8.0)
mongo (1.9.0)
mustache (0.99.4)
rack (1.5.2)
rack-protection (1.5.0)
rack-test (0.6.2)
rake (10.1.0)
rubygems-bundler (1.2.2)
rvm (1.11.3.8)
sass (3.2.10)
sass-globbing (1.1.0)
sinatra (1.4.3)
sinatra-contrib (1.4.0)
sinatra-mustache (0.1.0)
tilt (1.4.1)
vegas (0.1.11)
➜  Sites  rvm reload && gem list
RVM reloaded!

*** LOCAL GEMS *** 

Nothing.

我没有 .bashrc 也没有 .bash_profile.我的 .zprofile 中没有 RVM 引用,这是我的 .zshrc :

I have no .bashrc nor .bash_profile. There is no RVM reference in my .zprofile and here is my .zshrc :

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
ZSH_THEME="robbyrussell"
DEFAULT_USER="anahkiasen"

# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
plugins=(git bower brew composer gem laravel sublime)

## RVM and Rubygems
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

source $ZSH/oh-my-zsh.sh

我尝试交换以上两行,尝试将 RVM 加载移动到 .zprofile 中,但没有.每次我打开终端的新实例时,默认值都消失了.它加载了正确的 ruby​​,这意味着如果我执行 ruby -v 我得到我想要的版本,但对于 RVM 它没有加载,因此我没有任何 gemsets.

I've tried swapping the above two lines, tried moving the RVM loading into .zprofile, nothing. Everytime I open a new instance of the terminal, the default is gone. It loads the correct ruby, meaning if I do ruby -v I get the version I want, but for RVM it's not loaded and thus I have none of the gemsets.

我也试过rvm --default use 2.0.0rvm use 2.0.0@develop --default 但结果一样.

I've also tried rvm --default use 2.0.0, rvm use 2.0.0@develop --default but same result.

我已经重新安装了 RVM,我已经递归地将 .rvm 文件夹的权限设置为当前用户,什么都没有.

I've reinstalled RVM, I've set recursively the permissions of the .rvm folder to the current user, nothing.

那一刻我有点绝望.

推荐答案

当您使用 OH-MY-ZSH 时,您可能会遇到与此类似的问题:https://github.com/robbyrussell/oh-my-zsh/pull/1359

As you are using OH-MY-ZSH you might be hitting issue similar to this: https://github.com/robbyrussell/oh-my-zsh/pull/1359

RVM 有修复"功能,运行:

RVM has a "fix" function, run:

rvm get head --auto-dotfiles

它将重新组织您的点文件 - 阅读输出并按照说明进行操作很重要.

It will reorganize your dot files - it is important to read the output and follow instructions.

确保使用登录 shell 以获得最佳效果.

Make sure to use login shell for best effect.

这篇关于RVM 无法将 ruby​​ 设置为默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆