如何将 RVM 与 tcsh 一起使用? [英] How do I use RVM with tcsh?

查看:71
本文介绍了如何将 RVM 与 tcsh 一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 tcsh 中使用 RVM;我该怎么做?

I would like to use RVM with tcsh; how do I do this?

据我所知,没有关于此的官方"说明.我按照将 RVM 与 tcsh 结合使用"上的说明进行操作,但这对我不起作用;特别是,我无法访问 Ruby 二进制文件 rubybundleirbrspec 等.

As far as I can see, there are no "official" instructions for this. I followed the instructions on "Using RVM with tcsh", but this didn't work for me; in particular, I don't have access to the Ruby binaries ruby, bundle, irb, rspec, etc.

推荐答案

我所做的是使用 env | 从 bash 中获取所有与 rvm 相关的环境变量 |grep -i rvm.

然后我将它们复制到我的 ~/.tcshrc,并将 ruby​​ 版本替换为 $ruby_version:

I then copied them to my ~/.tcshrc, and substituted the ruby version with $ruby_version:

if ( ! $?ruby_version ) then
    set ruby_version = `grep RUBY_VERSION ~/.rvm/environments/default | cut -d= -f2 | tr -d \' | sed 's/^ruby-//'`
end

setenv rvm_bin_path $HOME/.rvm/bin
setenv GEM_HOME $HOME/.rvm/gems/ruby-$ruby_version
setenv IRBRC $HOME/.rvm/rubies/ruby-$ruby_version/.irbrc
setenv MY_RUBY_HOME $HOME/.rvm/rubies/ruby-$ruby_version
setenv rvm_path $HOME/.rvm
setenv rvm_prefix $HOME
setenv PATH $HOME/.rvm/gems/ruby-$ruby_version/bin:$HOME/.rvm/gems/ruby-$ruby_version@global/bin:$HOME/.rvm/rubies/ruby-$ruby_version/bin:${PATH}:$HOME/.rvm/bin
setenv GEM_PATH $HOME/.rvm/gems/ruby-${ruby_version}:$HOME/.rvm/gems/ruby-${ruby_version}@global

$ruby_version 将设置为默认值;如果它是空的;要使用不同的 ruby​​ 版本,我可以这样做:

$ruby_version will be set to the default; if it's empty; to use a different ruby version, I can do:

% set ruby_version = 1.9.3-p547
% source ~/.tcshrc

使用(某些)rvm 命令,例如 rvm installrvm list 似乎也有效;但是 rvm use 没有(您需要使用 $ruby-version 解决方法).不过,我没有检查所有其他命令.

Using (some) rvm commands, such as rvm install or rvm list also seem to work; but rvm use doesn't (you need to use the $ruby-version workaround). I didn't check all the other commands, though.

这篇关于如何将 RVM 与 tcsh 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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